Created
November 11, 2014 00:11
-
-
Save reidmv/4d12bb7602a0e78af8f9 to your computer and use it in GitHub Desktop.
autobefore in Puppet
This file contains hidden or 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
# This type needs to implement an "autobefore" kind of behavior. Currently | |
# the Puppet type system only supports autorequire, so we achieve autobefore | |
# by hijacking autorequire. | |
def autorequire(rel_catalog = nil) | |
reqs = super | |
[ @parameters[:prior_to].value, | |
@parameters[:resource].value | |
].flatten.each do |rel| | |
reqs << Puppet::Relationship::new(self, catalog.resource(rel.to_s)) | |
end | |
reqs | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment