Re: [Puppet Users] Default Values with External Nodes

Dan Bode
Sun, 20 Jun 2010 18:10:21 -0000

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.