Created
January 19, 2014 18:23
-
-
Save ptomulik/8508834 to your computer and use it in GitHub Desktop.
Add features and properties dynamically to a resource type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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