Afternoon all I''m sure this is probably a nice n easy one, but I can''t work it out for the life of me... Anyhow, I''ve got the following code: # Load db yaml data $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') notify{"DB Details loaded... About to parse.":} -> notify{"DB Details = ${db_details}.":} #$hostname = lookupvar(''{hostname}'') # Parse data and filter to only primary databses for this server $databases = parse_databases($db_details, ''database_primay_server'', $::hostname) notify{"Parsed db details, creating resources.":} -> notify{"Databases = ${databases}":} # Create required resources... if $::oracle_netapp { notify{"\$::oracle_netapp is true.":} create_resources( act::env::oracle::instance::netapp, $databases) } Parse_databases() is a custom function within one of my modules.. The problem I''ve got is that parse_databases appears to be running before loadyaml... Example client run: Notice: DB Details loaded... About to parse. Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details loaded... About to parse.]/message: defined ''message'' as ''DB Details loaded... About to parse.'' Notice: Parsed db details, creating resources. Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Parsed db details, creating resources.]/message: defined ''message'' as ''Parsed db details, creating resources.'' Notice: Databases Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Databases = ]/message: defined ''message'' as ''Databases = '' Notice: $::oracle_netapp is true. Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[$::oracle_netapp is true.]/message: defined ''message'' as ''$::oracle_netapp is true.'' Notice: DB Details = PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05. Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details = PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.]/message: defined ''message'' as ''DB Details = PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.'' So how can I get the ordering right??? Cheers Gavin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Jan 31, 2013 at 5:52 PM, Gavin Williams <fatmcgav@gmail.com> wrote:> Afternoon all > > I''m sure this is probably a nice n easy one, but I can''t work it out for the > life of me... > > Anyhow, I''ve got the following code: > # Load db yaml data > $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') > > notify{"DB Details loaded... About to parse.":} > -> > notify{"DB Details = ${db_details}.":} > > #$hostname = lookupvar(''{hostname}'') > # Parse data and filter to only primary databses for this server > $databases = parse_databases($db_details, ''database_primay_server'', > $::hostname) > > notify{"Parsed db details, creating resources.":} > -> > notify{"Databases = ${databases}":} > > # Create required resources... > if $::oracle_netapp { > notify{"\$::oracle_netapp is true.":} > create_resources( act::env::oracle::instance::netapp, $databases) > } > > Parse_databases() is a custom function within one of my modules..And I assume that the module that defines/declares parse_databases() is ''include''d just above this snippet? Not that I''m sure it will change things. If not... As $db_details is only used by the parse_databases() function (in this snippet), is it possible to move the call to loadyaml() within the function itself? I''ve assumed you need $db_details further on outside of the code you showed here, but thought I''d suggest the bleeding obvious, just in case :-) Thanks, Matt. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Matt Yeh, the function is defined within this module... I''ll give moving the loadyaml into parse_databases a go when back in the office in the morning... Any other ideas welcome though... Cheers Gavin On Jan 31, 2013 8:43 PM, "Matthew Burgess" <matthew.2.burgess@gmail.com> wrote:> On Thu, Jan 31, 2013 at 5:52 PM, Gavin Williams <fatmcgav@gmail.com> > wrote: > > Afternoon all > > > > I''m sure this is probably a nice n easy one, but I can''t work it out for > the > > life of me... > > > > Anyhow, I''ve got the following code: > > # Load db yaml data > > $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') > > > > notify{"DB Details loaded... About to parse.":} > > -> > > notify{"DB Details = ${db_details}.":} > > > > #$hostname = lookupvar(''{hostname}'') > > # Parse data and filter to only primary databses for this server > > $databases = parse_databases($db_details, ''database_primay_server'', > > $::hostname) > > > > notify{"Parsed db details, creating resources.":} > > -> > > notify{"Databases = ${databases}":} > > > > # Create required resources... > > if $::oracle_netapp { > > notify{"\$::oracle_netapp is true.":} > > create_resources( act::env::oracle::instance::netapp, $databases) > > } > > > > Parse_databases() is a custom function within one of my modules.. > > And I assume that the module that defines/declares parse_databases() > is ''include''d just above this snippet? Not that I''m sure it will > change things. If not... > > As $db_details is only used by the parse_databases() function (in this > snippet), is it possible to move the call to loadyaml() within the > function itself? I''ve assumed you need $db_details further on outside > of the code you showed here, but thought I''d suggest the bleeding > obvious, just in case :-) > > Thanks, > > Matt. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Nothing about your notify resources is actually telling you what''s going on with the variables. Just because the details notify happens last, doesn''t mean that the variable was evaluated at that time. Variable assignment is parse-order dependent. I''d look to make sure your custom function actually works. On Thursday, January 31, 2013 1:48:25 PM UTC-7, Gavin Williams wrote:> > Matt > > Yeh, the function is defined within this module... > > I''ll give moving the loadyaml into parse_databases a go when back in the > office in the morning... > > Any other ideas welcome though... > > Cheers > Gavin > On Jan 31, 2013 8:43 PM, "Matthew Burgess" <matthew....@gmail.com<javascript:>> > wrote: > >> On Thu, Jan 31, 2013 at 5:52 PM, Gavin Williams <fatm...@gmail.com<javascript:>> >> wrote: >> > Afternoon all >> > >> > I''m sure this is probably a nice n easy one, but I can''t work it out >> for the >> > life of me... >> > >> > Anyhow, I''ve got the following code: >> > # Load db yaml data >> > $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') >> > >> > notify{"DB Details loaded... About to parse.":} >> > -> >> > notify{"DB Details = ${db_details}.":} >> > >> > #$hostname = lookupvar(''{hostname}'') >> > # Parse data and filter to only primary databses for this server >> > $databases = parse_databases($db_details, ''database_primay_server'', >> > $::hostname) >> > >> > notify{"Parsed db details, creating resources.":} >> > -> >> > notify{"Databases = ${databases}":} >> > >> > # Create required resources... >> > if $::oracle_netapp { >> > notify{"\$::oracle_netapp is true.":} >> > create_resources( act::env::oracle::instance::netapp, $databases) >> > } >> > >> > Parse_databases() is a custom function within one of my modules.. >> >> And I assume that the module that defines/declares parse_databases() >> is ''include''d just above this snippet? Not that I''m sure it will >> change things. If not... >> >> As $db_details is only used by the parse_databases() function (in this >> snippet), is it possible to move the call to loadyaml() within the >> function itself? I''ve assumed you need $db_details further on outside >> of the code you showed here, but thought I''d suggest the bleeding >> obvious, just in case :-) >> >> Thanks, >> >> Matt. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users...@googlegroups.com <javascript:>. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, January 31, 2013 11:52:41 AM UTC-6, Gavin Williams wrote:> > Afternoon all > > I''m sure this is probably a nice n easy one, but I can''t work it out for > the life of me... > > Anyhow, I''ve got the following code: > # Load db yaml data > $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') > > notify{"DB Details loaded... About to parse.":} > -> > notify{"DB Details = ${db_details}.":} > > #$hostname = lookupvar(''{hostname}'') > # Parse data and filter to only primary databses for this server > $databases = parse_databases($db_details, ''database_primay_server'', > $::hostname) > > notify{"Parsed db details, creating resources.":} > -> > notify{"Databases = ${databases}":} > > # Create required resources... > if $::oracle_netapp { > notify{"\$::oracle_netapp is true.":} > create_resources( act::env::oracle::instance::netapp, $databases) > } > > Parse_databases() is a custom function within one of my modules.. > > The problem I''ve got is that parse_databases appears to be running before > loadyaml... > Example client run: > Notice: DB Details loaded... About to parse. > Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details > loaded... About to parse.]/message: defined ''message'' as ''DB Details > loaded... About to parse.'' > Notice: Parsed db details, creating resources. > Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Parsed db > details, creating resources.]/message: defined ''message'' as ''Parsed db > details, creating resources.'' > Notice: Databases > Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Databases = > ]/message: defined ''message'' as ''Databases = '' > Notice: $::oracle_netapp is true. > Notice: > /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[$::oracle_netapp is > true.]/message: defined ''message'' as ''$::oracle_netapp is true.'' > Notice: DB Details = > PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05. > Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details = > PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.]/message: > defined ''message'' as ''DB Details = > PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.'' > > So how can I get the ordering right??? > >The ordering is probably right already. At least, I don''t see how we''re supposed to infer otherwise from the agent''s output. Functions execute on the master, at catalog compile time. The relative order in which resources are applied on the client, however, is constrained only by the relationships declared among them -- it does not inform about the order in which the resources were parsed, and informs only indirectly about the order in which functions in the declaring manifests were run. Class bodies are parsed left-to-right, top-to-bottom. You could use the notice() function to emit messages to the *master''s* log about your evaluation order, but if you don''t trust functions to be evaluated according to parse order then you''ll want to include something in the notice() messages to prove it. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
After all that, it looks like the function was doing exactly what it was designed to... Filtering out irrelevant data... However feeding it incorrect filters meant that it was filtering everything... Doh... Cheers Gavin On Thursday, 31 January 2013 22:37:30 UTC, jcbollinger wrote:> > > > On Thursday, January 31, 2013 11:52:41 AM UTC-6, Gavin Williams wrote: >> >> Afternoon all >> >> I''m sure this is probably a nice n easy one, but I can''t work it out for >> the life of me... >> >> Anyhow, I''ve got the following code: >> # Load db yaml data >> $db_details = loadyaml(''/etc/puppet/data/databases.yaml'') >> >> notify{"DB Details loaded... About to parse.":} >> -> >> notify{"DB Details = ${db_details}.":} >> >> #$hostname = lookupvar(''{hostname}'') >> # Parse data and filter to only primary databses for this server >> $databases = parse_databases($db_details, ''database_primay_server'', >> $::hostname) >> >> notify{"Parsed db details, creating resources.":} >> -> >> notify{"Databases = ${databases}":} >> >> # Create required resources... >> if $::oracle_netapp { >> notify{"\$::oracle_netapp is true.":} >> create_resources( act::env::oracle::instance::netapp, $databases) >> } >> >> Parse_databases() is a custom function within one of my modules.. >> >> The problem I''ve got is that parse_databases appears to be running before >> loadyaml... >> Example client run: >> Notice: DB Details loaded... About to parse. >> Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details >> loaded... About to parse.]/message: defined ''message'' as ''DB Details >> loaded... About to parse.'' >> Notice: Parsed db details, creating resources. >> Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Parsed db >> details, creating resources.]/message: defined ''message'' as ''Parsed db >> details, creating resources.'' >> Notice: Databases >> Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[Databases = >> ]/message: defined ''message'' as ''Databases = '' >> Notice: $::oracle_netapp is true. >> Notice: >> /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[$::oracle_netapp is >> true.]/message: defined ''message'' as ''$::oracle_netapp is true.'' >> Notice: DB Details = >> PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05. >> Notice: /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[DB Details = >> PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.]/message: >> defined ''message'' as ''DB Details = >> PUTEST01oracle_version11.2.0.3netapp_primary_controlleract-star-nactl02volumesoractrlsize1goradatasize100goraarchsnapscheduleminutes0which-hours0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23days0weeks0which-minutes0hours36size50gnetapp_snapmirror_controlleract-bun-nactl02database_primary_serveract-star-db05.'' >> >> So how can I get the ordering right??? >> >> > > The ordering is probably right already. At least, I don''t see how we''re > supposed to infer otherwise from the agent''s output. Functions execute on > the master, at catalog compile time. The relative order in which resources > are applied on the client, however, is constrained only by the > relationships declared among them -- it does not inform about the order in > which the resources were parsed, and informs only indirectly about the > order in which functions in the declaring manifests were run. > > Class bodies are parsed left-to-right, top-to-bottom. You could use the > notice() function to emit messages to the *master''s* log about your > evaluation order, but if you don''t trust functions to be evaluated > according to parse order then you''ll want to include something in the > notice() messages to prove it. > > > John > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.