Created
September 6, 2012 12:19
-
-
Save zipkid/3655676 to your computer and use it in GitHub Desktop.
Hiera puppet lookup Puppet 3
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
--- | |
:hierarchy: | |
- common | |
:backends: | |
- puppet | |
:puppet: | |
datasource: data |
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
# 2 tries... (1 at a time of course..) | |
class p3t ( $somevar = '' ) | |
class p3t ( $somevar = hiera('somevar','') ) | |
{ | |
notify { "test: $somevar": } | |
} | |
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
def hierarchy(scope, override) | |
begin | |
data_class = Config[:puppet][:datasource] || "data" | |
rescue | |
data_class = "data" | |
end | |
# added Debug output here... | |
Hiera.debug( " scope :#{scope}: " ) | |
Hiera.debug( " scope.resource :#{scope.resource}: " ) | |
Hiera.debug( " scope.resource.name :#{scope.resource.name}: " ) | |
calling_class = scope.resource.name.to_s.downcase | |
calling_module = calling_class.split("::").first |
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
# result of using class p3t ( $somevar = '' ) | |
Debug: Automatically imported p3t from p3t into production | |
Debug: hiera(): Hiera Puppet backend starting | |
Debug: hiera(): Looking up p3t::somevar in Puppet backend | |
Debug: hiera(): scope :#<Puppet::Indirector::Hiera::FakeScope:0x7f03abf1fdf0>: | |
Debug: hiera(): scope.resource :#<struct #<Class:0x7f03abf22de8> name="fake">: | |
Debug: hiera(): scope.resource.name :fake: | |
Debug: hiera(): Looking for data in data::common | |
Debug: hiera(): Found data in class data::common | |
Debug: hiera(): Looking for data in fake::data | |
Debug: hiera(): Found data in class fake::data | |
Compiled catalog for pm3.lan.super-visions.com in environment production in 0.15 seconds | |
# and using class p3t ( $somevar = hiera('somevar','') ) | |
Debug: Automatically imported p3t from p3t into production | |
Debug: hiera(): Hiera Puppet backend starting | |
Debug: hiera(): Looking up p3t::somevar in Puppet backend | |
Debug: hiera(): scope :#<Puppet::Indirector::Hiera::FakeScope:0x7f79f7558390>: | |
Debug: hiera(): scope.resource :#<struct #<Class:0x7f79f7560b58> name="fake">: | |
Debug: hiera(): scope.resource.name :fake: | |
Debug: hiera(): Looking for data in data::common | |
Debug: hiera(): Found data in class data::common | |
Debug: hiera(): Looking for data in fake::data | |
Debug: hiera(): Found data in class fake::data | |
Debug: hiera(): Looking up somevar in Puppet backend | |
Debug: hiera(): scope :Scope(Class[P3t]): | |
Debug: hiera(): scope.resource :Class[P3t]: | |
Debug: hiera(): scope.resource.name :P3t: | |
Debug: hiera(): Looking for data in data::common | |
Debug: importing '/etc/puppet-modules/p3t/manifests/data.pp' in environment production | |
Debug: hiera(): Looking for data in p3t::data | |
Compiled catalog for pm3.lan.super-visions.com in environment production in 0.16 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment