Patrick Schoenfeld: Sharing code between puppet providers
So you ve written that custom puppet type for something and start working on another puppet type in the same module. What if you needed to share some code between this types? Is there a way of code-reuse that works with the plugin sync mechanism?
Yes, there is.
Puppet even has two possible ways of sharing code between types.
Option #1: a shared base provider
A provider in puppet is basically a class associated with a certain (puppet) type and there can be a lot providers for a single type (just look at the package provider!). It seems quiet natural, that it s possible to define a parent class for those providers. So natural, that even the official puppet documentation writes about it.
Option #2: Shared libraries
The second option is a shared library, shipped in a certain namespace in the lib directory of the module, whereas the idea is mostly sketched in the feature ticket #14149. Basically one defines a class in the special Puppetx namespace, using the author- and module-name in the class name, in order to avoid conflicts with other modules.
require 'puppetx' module Puppetx::<Author> module Puppetx::<Author>::<Modulename> ... your helper functions go here ... end endThis example would be saved to
lib/<author>/<modulename>in your module s folder and be included in your provider with something along the following:
require
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..",
"puppet_x", "<author>", "<modulename>.rb"))Compatibility with Puppet 4:
In puppet 4 the name of the namespace has changed slightly. It s now called PuppetX instead of Puppetx and is stored in a file puppet_x.rb , which means that the require and the module name itself need to be changed:require 'puppet_x' module PuppetX::<authorname> module PuppetX::<authorname>::<modulename>For backward compatibility with puppet 3 you could instead add something like this, according to my co-worker mxey, who knows way more about ruby then I do:
module PuppetX module <Author> <Modulename> = Puppetx::<Authorname>::<Modulename> end endApart from this you d need to change the require to be conditional on the puppet-version and refer to the module by the aliased version (which is left as an exercise for the reader ;))
Whilst the rest of Debian was very busy actually making the Jessie release, I was trying to prepare the ground to test the armhf installer images.
Cubietruck is fine, it s a nice install and the
Repeating what I did for the last Debian release with the 
What happens if you remove randomness from
I'm happy with the progress we've made for debian-installer and
related packages for the Jessie release. We're going to end up with a
release that's better in a number of ways than what we've had
before.
1. Big EFI enhancements
I've already blogged a lot about the stuff I've worked on here, so
I'll just summarise for now some of the improvements we've got over
Wheezy.
There will be a gathering of Debian people to celebrate the release of
jessie this Saturday in Helsinki. For details, see the
Tollef posted about using
A new major version 5.000 of
I've had a half-broken temperature monitoring setup at home for quite
some time. It started out with a Atom-based NAS, a USB-serial adapter
and a passive 1-wire adapter. It sometimes worked, then stopped
working, then started when poked with a stick. Later, the NAS was
moved under the stairs and I put a Beaglebone Black in its old place.
The temperature monitoring thereafter never really worked, but I
didn't have the time to fix it. Over the last few days, I've managed
to get it working again, of course by replacing nearly all the
existing components.
I'm using the DS18B20 sensors. They're about USD 1 a piece on Ebay
(when buying small quantities) and seems to work quite ok.
My first task was to address the reliability problems: Dropouts and
really poor performance. I thought the passive adapter was
problematic, in particular with the wire lengths I'm using and I
therefore wanted to replace it with something else. The BBB has GPIO
support, and various blog posts suggested using that. However, I'm
running Debian on my BBB which doesn't have support for DTB
overrides, so I needed to patch the kernel DTB. (Apparently, DTB
overrides are landing upstream, but obviously not in time for Jessie.)
I've never even looked at Device Tree before, but the structure was
reasonably simple and with a 

