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


Chronological Thread 
  • From: Peter Loron < >
  • To:
  • Subject: [chef] Re: Remove a user from a group?
  • Date: Wed, 20 Mar 2013 23:35:25 -0700

This does not appear to be working on Windows 2008 R2 with Chef omnibus 11.2 and Ohai 6.16.0. The "etc" section in the output looks like this:

  "etc": {
    "passwd": {

    },
    "group": {

    }
  }

-Pete

On Mar 15, 2013, at 4:47 PM, Ranjib Dey < "> > wrote:

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.

§