FAQ
As I try to get some flexibility in the creation of users, I switched to a
define.
problem is, I can't pass an array of user groups anymore. This either
results in
- wrong group creation: group1,group1group2,group2 (see that group1 and
group2 are concatenated in the middle, undefined group)
- error: Group names must be provided as an array, not a comma-separated
list.


I use the following define:

define users::definitions (
$home = "/home/$title",
$usergroups = $title,
$ifensure = 'present',
) {
user {
"$title":
home => "$home",
managehome => true,
ensure => "$ifensure",
groups => "$usergroups",
}
...
}

And the following class to call the define:

class users {
users::definitions {
'rsnapshot':
usergroups => [ 'group1', 'group2' ];
}
}

Does anyone have an idea how to pass an array of groups to a define?

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ahHYu4WJclkJ.
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.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Eric Sorenson at Nov 9, 2012 at 8:26 pm
    Erwin, the variable is probably coming into the define correctly, but
    you're quoting "$usergroups" in the user resource which will concatenate
    the values together... remove the quotes and all should be well..
    On Friday, November 9, 2012 5:19:31 AM UTC-8, Erwin Bogaard wrote:

    As I try to get some flexibility in the creation of users, I switched to a
    define.
    problem is, I can't pass an array of user groups anymore. This either
    results in
    - wrong group creation: group1,group1group2,group2 (see that group1 and
    group2 are concatenated in the middle, undefined group)
    - error: Group names must be provided as an array, not a comma-separated
    list.


    I use the following define:

    define users::definitions (
    $home = "/home/$title",
    $usergroups = $title,
    $ifensure = 'present',
    ) {
    user {
    "$title":
    home => "$home",
    managehome => true,
    ensure => "$ifensure",
    groups => "$usergroups",
    }
    ...
    }

    And the following class to call the define:

    class users {
    users::definitions {
    'rsnapshot':
    usergroups => [ 'group1', 'group2' ];
    }
    }

    Does anyone have an idea how to pass an array of groups to a define?
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/HQGmI46087UJ.
    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.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Erwin Bogaard at Nov 9, 2012 at 9:08 pm
    Hi Eric.
    removing the quotes fixed it! If only all problems were that easy to fix ;-)
    Thanks, Erwin
    On Friday, November 9, 2012 9:26:11 PM UTC+1, Eric Sorenson wrote:

    Erwin, the variable is probably coming into the define correctly, but
    you're quoting "$usergroups" in the user resource which will concatenate
    the values together... remove the quotes and all should be well..
    On Friday, November 9, 2012 5:19:31 AM UTC-8, Erwin Bogaard wrote:

    As I try to get some flexibility in the creation of users, I switched to
    a define.
    problem is, I can't pass an array of user groups anymore. This either
    results in
    - wrong group creation: group1,group1group2,group2 (see that group1 and
    group2 are concatenated in the middle, undefined group)
    - error: Group names must be provided as an array, not a comma-separated
    list.


    I use the following define:

    define users::definitions (
    $home = "/home/$title",
    $usergroups = $title,
    $ifensure = 'present',
    ) {
    user {
    "$title":
    home => "$home",
    managehome => true,
    ensure => "$ifensure",
    groups => "$usergroups",
    }
    ...
    }

    And the following class to call the define:

    class users {
    users::definitions {
    'rsnapshot':
    usergroups => [ 'group1', 'group2' ];
    }
    }

    Does anyone have an idea how to pass an array of groups to a define?
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/K4nVjDO1l94J.
    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.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedNov 9, '12 at 1:19p
activeNov 9, '12 at 9:08p
posts3
users2
websitepuppetlabs.com

2 users in discussion

Erwin Bogaard: 2 posts Eric Sorenson: 1 post

People

Translate

site design / logo © 2021 Grokbase