Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active July 20, 2018 17:50
Show Gist options
  • Save binford2k/5d1d8ff3e5c2184b167915c2c4e6853d to your computer and use it in GitHub Desktop.
Save binford2k/5d1d8ff3e5c2184b167915c2c4e6853d to your computer and use it in GitHub Desktop.
[root@ip-172-31-20-152 modules]# cat foo/manifests/params.pp
class foo::params {
$bar = 'baz'
}
[root@ip-172-31-20-152 modules]# cat foo/manifests/something.pp
class foo::something {
# this does NOT resolve up to $foo::bar because it has no parent class
notify { $bar: }
}
[root@ip-172-31-20-152 modules]# cat foo/manifests/init.pp
class foo inherits foo::params {
notify { $bar: }
include foo::something # Scope does NOT follow down to this class
}
[root@ip-172-31-20-152 modules]# puppet apply -e 'include foo'
Warning: Unknown variable: 'bar'. at /opt/puppetlabs/puppet/modules/foo/manifests/something.pp:3:12
Error: Evaluation Error: Missing title. The title expression resulted in undef at /opt/puppetlabs/puppet/modules/foo/manifests/something.pp:3:12 on node ip-172-31-20-152.us-west-2.compute.internal[root@ip-172-31-20-152 modules]# puppet --version
5.1.0
[root@ip-172-31-20-152 modules]# cat foo/manifests/params.pp
class foo::params {
$bar = 'baz'
}
[root@ip-172-31-20-152 modules]# cat foo/manifests/init.pp
class foo inherits foo::params {
notify { $bar: }
}
[root@ip-172-31-20-152 modules]# puppet apply -e 'include foo'
Notice: Compiled catalog for ip-172-31-20-152.us-west-2.compute.internal in environment production in 0.03 seconds
Notice: baz
Notice: /Stage[main]/Foo/Notify[baz]/message: defined 'message' as 'baz'
Notice: Applied catalog in 0.02 seconds
[root@ip-172-31-20-152 modules]# puppet --version
5.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment