I''m in the process of trying to convert our current node implementation to external nodes. The definitions that we called from our node manifests have been replaced by variables passed back to classes in modules. When using definitions, we could set default values in the definition, and therefore we didn''t always have to pass every argument. However, now that I am using variables to set data, and calling definitions from that inside the classes, I have no way that I can see to set default values. Eg: If the external node has: --- classes: - server_role::appServer - elements::tfel4 environment: production parameters: tfel4_ClusterDescription: "Cluster1" tfel4_ClusterWebUrl: "https://qa4.xxx.com" tfel4_ClusterDbHost: "ora02.xxx.twofish.com" tfel4_ClusterDbPort: 1521 tfel4_ClusterDbType: oracle I would like the option to not to have to set tfel4_ClusterDbType, and have it default to Oracle. In the class I have this: some_definition { key1 => val1, dbprov => ${tfel4_ClusterDbType} } As you can see, since classes have no default values, I have to set it some way. I tried this: if ! defined($tfel4_ClusterDbType) { $tfel4_ClusterDbType = "oracle" } but then returns an error: "Could not retrieve catalog: interning empty string at /etc/puppet/modules/elements/manifests/tfel4.pp:48" I also tried: case $tfel4_ClusterDbType { "": { $tfel4_ClusterDbType = "oracle" } } which gives me this, indicating that the value wasn''t set. "Could not retrieve catalog: Could not find template /etc/puppet/modules/starterkit/templates/jboss_inst/deploy/eazyedb-xa-ds.xml..erb" How can I do this? Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Sun, Jun 20, 2010 at 11:05 AM, Douglas Garstang <doug.garstang@gmail.com>wrote:> I''m in the process of trying to convert our current node > implementation to external nodes. The definitions that we called from > our node manifests have been replaced by variables passed back to > classes in modules. When using definitions, we could set default > values in the definition, and therefore we didn''t always have to pass > every argument. However, now that I am using variables to set data, > and calling definitions from that inside the classes, I have no way > that I can see to set default values. > > Eg: > If the external node has: > > --- > classes: > - server_role::appServer > - elements::tfel4 > environment: production > parameters: > tfel4_ClusterDescription: "Cluster1" > tfel4_ClusterWebUrl: "https://qa4.xxx.com" > tfel4_ClusterDbHost: "ora02.xxx.twofish.com" > tfel4_ClusterDbPort: 1521 > tfel4_ClusterDbType: oracle > > I would like the option to not to have to set tfel4_ClusterDbType, and > have it default to Oracle. In the class I have this: > > some_definition { > key1 => val1, > dbprov => ${tfel4_ClusterDbType} > } > > As you can see, since classes have no default values, I have to set it > some way. I tried this: > > if ! defined($tfel4_ClusterDbType) { > $tfel4_ClusterDbType = "oracle" > } >if (! $tfel4_ClusterDbType) { $tfel4_ClusterDbType = "oracle" }> > but then returns an error: > "Could not retrieve catalog: interning empty string at > /etc/puppet/modules/elements/manifests/tfel4.pp:48" > > I also tried: > > case $tfel4_ClusterDbType { > "": { $tfel4_ClusterDbType = "oracle" } > } >> which gives me this, indicating that the value wasn''t set. > "Could not retrieve catalog: Could not find template > > /etc/puppet/modules/starterkit/templates/jboss_inst/deploy/eazyedb-xa-ds.xml..erb" > > How can I do this? > > Doug. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang
2010-Jun-20 18:16 UTC
Re: [Puppet Users] Default Values with External Nodes
On Sun, Jun 20, 2010 at 11:10 AM, Dan Bode <dan@puppetlabs.com> wrote:> > > On Sun, Jun 20, 2010 at 11:05 AM, Douglas Garstang <doug.garstang@gmail.com> > wrote: >> >> I''m in the process of trying to convert our current node >> implementation to external nodes. The definitions that we called from >> our node manifests have been replaced by variables passed back to >> classes in modules. When using definitions, we could set default >> values in the definition, and therefore we didn''t always have to pass >> every argument. However, now that I am using variables to set data, >> and calling definitions from that inside the classes, I have no way >> that I can see to set default values. >> >> Eg: >> If the external node has: >> >> --- >> classes: >> - server_role::appServer >> - elements::tfel4 >> environment: production >> parameters: >> tfel4_ClusterDescription: "Cluster1" >> tfel4_ClusterWebUrl: "https://qa4.xxx.com" >> tfel4_ClusterDbHost: "ora02.xxx.twofish.com" >> tfel4_ClusterDbPort: 1521 >> tfel4_ClusterDbType: oracle >> >> I would like the option to not to have to set tfel4_ClusterDbType, and >> have it default to Oracle. In the class I have this: >> >> some_definition { >> key1 => val1, >> dbprov => ${tfel4_ClusterDbType} >> } >> >> As you can see, since classes have no default values, I have to set it >> some way. I tried this: >> >> if ! defined($tfel4_ClusterDbType) { >> $tfel4_ClusterDbType = "oracle" >> } > > if (! $tfel4_ClusterDbType) { > $tfel4_ClusterDbType = "oracle" > }Doesn''t work. Gives error: "Could not retrieve catalog: Could not find template /etc/puppet/modules/starterkit/templates/jboss_inst/deploy/eazyedb-xa-ds.xml..erb" which means that the variable wasn''t set. The manifest at that line has: "/opt/jboss/current/server/${name}/deploy/eazyedb-xa-ds.xml": content => template("starterkit/jboss_inst/deploy/eazyedb-xa-ds.xml.${db_prov}.erb"), and db_prov is set by the definition called immediately after setting tfel4_ClusterDbType: elements::customer { tfel4: <lots of stuff set here> db_prov => "${tfel4_ClusterDbType}"; } } Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang
2010-Jun-20 18:31 UTC
Re: [Puppet Users] Default Values with External Nodes
On Sun, Jun 20, 2010 at 11:16 AM, Douglas Garstang <doug.garstang@gmail.com> wrote:> On Sun, Jun 20, 2010 at 11:10 AM, Dan Bode <dan@puppetlabs.com> wrote: >> >> >> On Sun, Jun 20, 2010 at 11:05 AM, Douglas Garstang <doug.garstang@gmail.com> >> wrote: >>> >>> I''m in the process of trying to convert our current node >>> implementation to external nodes. The definitions that we called from >>> our node manifests have been replaced by variables passed back to >>> classes in modules. When using definitions, we could set default >>> values in the definition, and therefore we didn''t always have to pass >>> every argument. However, now that I am using variables to set data, >>> and calling definitions from that inside the classes, I have no way >>> that I can see to set default values. >>> >>> Eg: >>> If the external node has: >>> >>> --- >>> classes: >>> - server_role::appServer >>> - elements::tfel4 >>> environment: production >>> parameters: >>> tfel4_ClusterDescription: "Cluster1" >>> tfel4_ClusterWebUrl: "https://qa4.xxx.com" >>> tfel4_ClusterDbHost: "ora02.xxx.twofish.com" >>> tfel4_ClusterDbPort: 1521 >>> tfel4_ClusterDbType: oracle >>> >>> I would like the option to not to have to set tfel4_ClusterDbType, and >>> have it default to Oracle. In the class I have this: >>> >>> some_definition { >>> key1 => val1, >>> dbprov => ${tfel4_ClusterDbType} >>> } >>> >>> As you can see, since classes have no default values, I have to set it >>> some way. I tried this: >>> >>> if ! defined($tfel4_ClusterDbType) { >>> $tfel4_ClusterDbType = "oracle" >>> } >> >> if (! $tfel4_ClusterDbType) { >> $tfel4_ClusterDbType = "oracle" >> } > > Doesn''t work. Gives error: > "Could not retrieve catalog: Could not find template > /etc/puppet/modules/starterkit/templates/jboss_inst/deploy/eazyedb-xa-ds.xml..erb" > > which means that the variable wasn''t set. The manifest at that line has: > > "/opt/jboss/current/server/${name}/deploy/eazyedb-xa-ds.xml": > content => > template("starterkit/jboss_inst/deploy/eazyedb-xa-ds.xml.${db_prov}.erb"), > > and db_prov is set by the definition called immediately after setting > tfel4_ClusterDbType: > > elements::customer { > tfel4: > <lots of stuff set here> > db_prov => "${tfel4_ClusterDbType}"; > } > } > > Doug. >Jeez... Even this doesn''t work: case $tfel4_ClusterDbType { undef: { $tfel4_ClusterDbType = "oracle" } } The use of undef is based on the puppet docs at http://docs.reductivelabs.com/guides/more_language.html. It just reports later that the variable tfel4_ClusterDbType has not been set. Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang
2010-Jun-20 18:33 UTC
Re: [Puppet Users] Default Values with External Nodes
Oh oh... This might be user error... On Sun, Jun 20, 2010 at 11:31 AM, Douglas Garstang <doug.garstang@gmail.com> wrote:> On Sun, Jun 20, 2010 at 11:16 AM, Douglas Garstang > <doug.garstang@gmail.com> wrote: >> On Sun, Jun 20, 2010 at 11:10 AM, Dan Bode <dan@puppetlabs.com> wrote: >>> >>> >>> On Sun, Jun 20, 2010 at 11:05 AM, Douglas Garstang <doug.garstang@gmail.com> >>> wrote: >>>> >>>> I''m in the process of trying to convert our current node >>>> implementation to external nodes. The definitions that we called from >>>> our node manifests have been replaced by variables passed back to >>>> classes in modules. When using definitions, we could set default >>>> values in the definition, and therefore we didn''t always have to pass >>>> every argument. However, now that I am using variables to set data, >>>> and calling definitions from that inside the classes, I have no way >>>> that I can see to set default values. >>>> >>>> Eg: >>>> If the external node has: >>>> >>>> --- >>>> classes: >>>> - server_role::appServer >>>> - elements::tfel4 >>>> environment: production >>>> parameters: >>>> tfel4_ClusterDescription: "Cluster1" >>>> tfel4_ClusterWebUrl: "https://qa4.xxx.com" >>>> tfel4_ClusterDbHost: "ora02.xxx.twofish.com" >>>> tfel4_ClusterDbPort: 1521 >>>> tfel4_ClusterDbType: oracle >>>> >>>> I would like the option to not to have to set tfel4_ClusterDbType, and >>>> have it default to Oracle. In the class I have this: >>>> >>>> some_definition { >>>> key1 => val1, >>>> dbprov => ${tfel4_ClusterDbType} >>>> } >>>> >>>> As you can see, since classes have no default values, I have to set it >>>> some way. I tried this: >>>> >>>> if ! defined($tfel4_ClusterDbType) { >>>> $tfel4_ClusterDbType = "oracle" >>>> } >>> >>> if (! $tfel4_ClusterDbType) { >>> $tfel4_ClusterDbType = "oracle" >>> } >> >> Doesn''t work. Gives error: >> "Could not retrieve catalog: Could not find template >> /etc/puppet/modules/starterkit/templates/jboss_inst/deploy/eazyedb-xa-ds.xml..erb" >> >> which means that the variable wasn''t set. The manifest at that line has: >> >> "/opt/jboss/current/server/${name}/deploy/eazyedb-xa-ds.xml": >> content => >> template("starterkit/jboss_inst/deploy/eazyedb-xa-ds.xml.${db_prov}.erb"), >> >> and db_prov is set by the definition called immediately after setting >> tfel4_ClusterDbType: >> >> elements::customer { >> tfel4: >> <lots of stuff set here> >> db_prov => "${tfel4_ClusterDbType}"; >> } >> } >> >> Doug. >> > > Jeez... Even this doesn''t work: > > case $tfel4_ClusterDbType { > undef: { $tfel4_ClusterDbType = "oracle" } > } > > The use of undef is based on the puppet docs at > http://docs.reductivelabs.com/guides/more_language.html. It just > reports later that the variable tfel4_ClusterDbType has not been set. > > Doug. >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.