Skip to content

Instantly share code, notes, and snippets.

@jeffmccune
Created June 14, 2011 23:05
Show Gist options
  • Save jeffmccune/1026152 to your computer and use it in GitHub Desktop.
Save jeffmccune/1026152 to your computer and use it in GitHub Desktop.
➜  puppet  puppet apply -v --modulepath /Users/jeff/src/manifests/modules{,/paramstest/tests/site.pp}
info: Applying configuration version '1308091819'
notice:  param=[I'm defined in paramstest::params] mandatory=[site.pp]
notice: /Stage[main]/Paramstest/Notify[TEST]/message: defined 'message' as ' param=[I'm defined in paramstest::params] mandatory=[site.pp]'
➜  puppet  git describe                                                                              
2.6.3
➜  puppet  git checkout 2.6.2
Previous HEAD position was 53bb805... Incremented CHANGELOG for 2.6.3
HEAD is now at 295c3be... Updated CHANGELOG for 2.6.2
➜  puppet  puppet apply -v --modulepath /Users/jeff/src/manifests/modules{,/paramstest/tests/site.pp}
warning: Scope(Class[Paramstest]): Could not look up qualified variable 'paramstest::params::param'; class paramstest::params has not been evaluated
info: Applying configuration version '1308092290'
notice:  param=[] mandatory=[site.pp]
notice: /Stage[main]/Paramstest/Notify[TEST]/message: defined 'message' as ' param=[] mandatory=[site.pp]
# Class: paramstest
#
# Use a variable from the params class
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
class paramstest (
$mandatory,
$param = 'UNSET'
) {
include paramstest::params
$param_real = $param ? {
'UNSET' => $::paramstest::params::param,
default => $param,
}
notify { 'TEST':
message => " param=[$param_real] mandatory=[$mandatory]",
}
}
# Class: paramstest::params
#
# Class params
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
class paramstest::params {
$param = "I'm defined in paramstest::params"
}
node default {
class { 'paramstest': mandatory => "site.pp" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment