Skip to content

Instantly share code, notes, and snippets.

@ptomulik
Created January 19, 2014 18:23
Show Gist options
  • Save ptomulik/8508834 to your computer and use it in GitHub Desktop.
Save ptomulik/8508834 to your computer and use it in GitHub Desktop.
Add features and properties dynamically to a resource type
# lib/puppet/backport/type/package/package_settings.rb
package = Puppet::Type.type(:package)
unless package.features.include? :package_settings
package.feature :package_settings ...
package.newproperty(:package_settings, :required_features=>:package_settings) do
...
end
end
# lib/puppet/provider/package/portsng.rb
require 'puppet/backport/type/package/package_settings' # "dynamically" add 'package_settings' to 'package' resource
Puppet::Type.type(:package).provide :portsng, :parent => Puppet::Provider::Package do
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment