So, I am trying to do something with a list (array) of users from hieara.
Here is the yaml:
profile::sysconfig::sftp_users: [ "joe", "bill", "nancy" ]
In my profile I have a defined class "debugUsers" that I am calling with
the array I got from hiera:
class profile::sysconfig::sftpserver {
> define debugUsers {
> notify { "username: \"${user}\"": }
> }
> class doWork {
> $users = hiera('profile::sysconfig::sftp_users')
> validate_array($users)
> debugUsers { $users: }
> }
> include doWork
}
>From everything I know and have read that should give me a notify line for
user in my array. But it doesn't. Instead I get this error from the agent:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Duplicate declaration: Notify[username: ""] is already declared in file
> /etc/puppetlabs/puppet/environments/r10k/dev_users/modules/profile/manifests/sysconfig/sftpserver.pp:5;
>
> cannot redeclare at
> /etc/puppetlabs/puppet/environments/r10k/dev_users/modules/profile/manifests/sysconfig/sftpserver.pp:5
>
Why am I getting duplicate null declarations? If I call out specific
elements of the array I get back exactly what I would expect:
class profile::sysconfig::sftpserver {
> class doWork {
> $users = hiera('profile::sysconfig::sftp_users')
> validate_array($users)
> notify { "user1: \"${users[0]}\"": }
> notify { "user2: \"${users[1]}\"": }
> notify { "user3: \"${users[2]}\"": }
> }
> include doWork
}
returns this:
Notice: user1: "joe"
> Notice: /Stage[main]/Profile::Sysconfig::Sftpserver::Dowork/Notify[user1:
> "joe"]/message: defined 'message' as 'user1: "joe"'
> Notice: user3: "nancy"
> Notice: /Stage[main]/Profile::Sysconfig::Sftpserver::Dowork/Notify[user3:
> "nancy"]/message: defined 'message' as 'user3: "nancy"'
> Notice: user2: "bill"
> Notice: /Stage[main]/Profile::Sysconfig::Sftpserver::Dowork/Notify[user2:
> "bill"]/message: defined 'message' as 'user2: "bill"'
I am sure this is something really stupid, but can someone point out what
I'm doing wrong here?
Thanks,
--Sean
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/4477ce95-b58e-4ead-80bc-5ae9ef0b5bda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.