On 2011-04-20 03:28, Miki Shapiro wrote:

> As suggested by Felix:
> Manifest says:
>         $keys = split(",", inline_template("<%= netifcfg.keys.join(',') 
> %>"))
>         exec { "/bin/echo keys are $keys and netifcfg is $netifcfg": 
> logoutput => true }
> 
> Output says:
> notice: /Stage[main]/Base::Network-common/Exec[/bin/echo keys are , and 
> netifcfg is 
> bond0ipaddress10.15.69.177netmask255.255.254.0defaultgatewayyesgateway10.15.68.1bond1ipadderss1.2.3.4netmask255.255.254.0gateway1.2.3.1]/returns:
>  keys are , and netifcfg is 
> bond0ipaddress10.15.69.177netmask255.255.254.0defaultgatewayyesgateway10.15.68.1bond1ipadderss1.2.3.4netmask255.255.254.0gateway1.2.3.1
> (Split doesn't seem to work).

You have two errors.  The first is that the split() function takes its
parameters in the other order from what Felix wrote.  The string to
split on goes second, so you should do:

    $keys = split(inline_template("<%= netifcfg.keys.join(',') %>"), ",")

The second error is that when you expand $keys within a string literal,
the elements of the array will be joined with nothing inbetween.  Try
this instead:

    notify {
        $keys: ;
    }

Or perhaps:

    notify {
        netifcfg-keys:
            message => shellquote("Keys", "are:", $keys);
    }

Those will show you better the real value of $keys.


        /Bellman

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to