[chef] Re: Re: Re: Remove a user from a group?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Re: Re: Remove a user from a group?
  • Date: Fri, 15 Mar 2013 16:47:12 -0700

just to add, this information is also provided via ohai, hence accessible from node object

as 
 node.etc.group.wheel.members
or 
node[:etc][:group][:wheel][:members]

On Fri, Mar 15, 2013 at 4:19 PM, AJ Christensen < " target="_blank"> > wrote:
The actions: manage does not create the group, modify does. You can
use combinations of create/remove manage/modify to allow a number of
group configurations.

You can use the ruby 'etc' std-lib module to query information about a
group at compile time (or converge via ruby_block. Shame we don't have
that delayed evaluation yet..)..

irb(main):001:0> require 'etc'
=> true
irb(main):002:0> wheel = Etc.getgrnam "wheel"
=> #<struct Struct::Group name="wheel", passwd="x", gid=10, mem=["root", "aj"]>
irb(main):003:0> wheel.mem
=> ["root", "aj"]

Cheers, HTH!

AJ

On 16 March 2013 12:10, Peter Loron < "> > wrote:
> Hi, AJ. From my reading of the group docs (URL below), I'm only seeing the
> ability to specify the complete set of users in a group, not the specific
> user to remove. If true, in order to remove a user from a group, I would
> need to know the list of all users in the group first, which I do not have.
> I could probably gin up a way to get that list, but it seems very broken to
> be able to add a specific user, but not remove one…
>
> Since I'm on the topic, is there any clarification between what the "manage"
> and "modify" actions do?
>
> http://docs.opscode.com/resource_group.html
>
> -Pete
>
> On Mar 15, 2013, at 3:41 PM, AJ Christensen < "> > wrote:
>
> You can :manage the entire group and remove a user from the 'members'
> attribute.
>
> Cheers,
>
> AJ
>
> On 16 March 2013 10:15, Peter Loron < "> > wrote:
>
> Hello. I'm working with the "group" provider, and I can see how to add a
> user to a local group. However, I don't see a clean way to remove a user
> from a group. My Google-fu has failed me. Can anybody shed some light on
> this? Thanks.
>
> -Pete
>
>




Archive powered by MHonArc 2.6.16.

§