Fantastic response, James - thanks.

-- 
Luke Kanies | +1-615-594-8199 | http://about.me/lak

On Dec 5, 2012, at 7:06 PM, James Polley <[email protected]> wrote:

To more verbosely explain what Aaron was so tersely implying, your problem
is that the error message says that "Group names must be provided as an
array"

When you provide them as:

  stephen:
    uid: 1003
    gid: stephen
    groups: - *dip ftp lock*
*
*
you're not providing them as an array, so there's no reason to think this
would work. Well, actually, you are providing them as an array - but it's
an array with a single member, the string "dip ftp lock", so naturally the
system looks for a group named "dip ftp lock"

There's two ways you can provide an array in YAML. The first is the block
style, which Aaron has demonstrated:

groups:
  - dip
  - ftp
  - lock

The second is the flow style:

groups: [dip, ftp, lock]



On Thu, Dec 6, 2012 at 12:41 PM, Aaron Grewell <[email protected]>wrote:

> groups:
>   - dip
>   -  ftp
>   -  lock
> On Dec 5, 2012 5:33 PM, "Stephen Wallace" <[email protected]>
> wrote:
>
>> Hi,
>>
>> Apologies if this should have been pointed at puppet-users in first
>> instance.
>>
>> I've noticed what I believe to be a bug relating to adding a user to
>> multiple groups using hiera. Target o/s are Oracle Enterprise Linux 5.5 and
>> 6. Apologies that I do not have a RHEL system to also test against.
>>
>> My hiera extract is as follows;
>>
>>   stephen:
>>     uid: 1003
>>     gid: stephen
>>     groups: -* dip,ftp,lock*
>>
>>
>> puppet agent -tv
>>
>> err: Failed to apply catalog: Parameter groups failed: Group names must
>> be provided as an array, *not a comma-separated list.*
>>
>> BUT
>>
>>   stephen:
>>     uid: 1003
>>     gid: stephen
>>     groups: - *dip ftp lock*
>>
>> err: /Stage[main]/Afg_adminusers/User[stephen]/ensure: change from absent
>> to present failed: Could not create user stephen: Execution of
>> '/usr/sbin/useradd -u 1003 -g stephen -*G dip ftp lock* -M stephen'
>> returned 6: useradd: unknown group dip ftp lock
>>
>> second run...
>>
>> err: /Stage[main]/Afg_adminusers/User[stephen]/groups: change from  to
>> dip ftp lock failed: Invalid value dip ftp lock: Groups must be
>> comma-separated
>>
>> The syntax being used appears to be incorrect for useradd. Should be...
>>
>> [root@esllatics2b ~]# /usr/sbin/useradd -u 1003 -g stephen* -G
>> dip,ftp,lock *-M stephen
>> Creating mailbox file: File exists
>>
>> ...i.e. comma separated additional groups are required from command line,
>> but I cant use the same list in hiera file.
>>
>> My nasty hack to make it work;
>>
>> vi /opt/puppet/lib/ruby/site_ruby/1.8/puppet/type/user.rb
>>
>>       validate do |value|
>>         if value =~ /^\d+$/
>>           raise ArgumentError, "Group names must be provided, not GID
>> numbers."
>>         end
>> # ORIG HASHED OFF        raise ArgumentError, "Group names must be
>> provided as an array, not a comma-separated list." if value.include?(",")
>>         raise ArgumentError, "Group names must be provided as an array,
>> not a comma-separated list." if value.include?*("not-commas")*
>>       end
>>
>>
>> notice: /Stage[main]/Afg_adminusers/User[stephen]/groups: groups changed
>> 'dip,ftp,lock' to 'dip,dip,ftp,lock,ftp,lock'
>> notice: Finished catalog run in 2.51 seconds
>>
>> :)
>>
>> However...every time I run puppet agent...I get the same output as above,
>> even though "stephen" has the correct group memberships.
>>
>> Your help appreciated.
>>
>> Regs,
>>
>> Stephen
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Developers" 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-dev?hl=en.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" 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-dev?hl=en.
>

 --
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to