Matt wrote:
> According to the language tutorial I should be able to do:
>
> $ssh_users = [ 'myself', 'someone' ]
>
> class test {
> $ssh_users += ['someone_else']
> }
>
> I'm trying to append to an array within a class, so i'm doing:
>
> class test {
> $metrics = ['a','b']
> $metrics += [''c]
> }
>
> With the above I get the following:
>
> err: Could not retrieve catalog: Cannot append, variable metrics is
> defined in this scope at
> /etc/puppet/production/modules/mymodule/manifests/metrics.pp:132 on
> node host.internal
>
> Can I only append to the variable once inside a class? I'm not
> worried about the order they get appended.
Hi Matt,
sorry for the late answer.
Yes, you cann assign/alter a variable only once within a scope.
A possible workaround would be a puppet function which takes any number
of arrays and returns their concatenation (or (distinct) union).
Regards, DavidS
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---