Last active
December 21, 2015 13:09
-
-
Save jfryman/6310732 to your computer and use it in GitHub Desktop.
AutoLoader
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
# autoloader.pp | |
class nagios::autoload_helpers { | |
$helpers = get_nagios_helpers() | |
case $::puppetversion { | |
/^3/: { include $helpers } | |
default: { | |
nagios::autoload_helpers::import_shim { $helpers: } | |
} | |
} | |
} |
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
module Puppet::Parser::Functions | |
newfunction(:get_nagios_helpers, | |
:type => :rvalue, | |
:doc => "Grab all modules that have nagios helpers for import") do | |
module_path = File.expand_path('..', | |
Puppet::Module.find('nagios',compiler.environment.to_s).path) | |
helpers = Dir["#{module_path}/**/nagios/helpers.pp"].map do |d| | |
"#{d.split('/')[-4]}::nagios::helpers" | |
done | |
helpers | |
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
include nagios::autoload_helpers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment