Groups

The groups resource adds support for managing chef groups.

Supported Operations

Index Fetch a list of all of the groups
Get Lookup group info
Create Create a new group
Update Update a group
Delete Delete a group
Exists Check if a group exists

API Reference

class pastry.resources.groups.Groups[source]

Provides access to the chef groups resource

classmethod create(group)[source]

Creates a new chef group on the server

The group hash should be in the form:

{
    'groupname': <groupname>,
    'name': <groupname>,
    'actors': { #optional
        'users': <list of usernames>, # optional
        'clients': <list of clients>, #optional
        'groups': <list of groups> #optional
    }
}
Parameters:group (hash) – The group to create
Returns:The groupname and url
Return type:hash
classmethod delete(groupname)[source]

Deletes a group from the chef server

Parameters:groupname (string) – The Group’s groupname
Returns:The deleted group’s name
Return type:hash
classmethod exists(groupname)[source]

Checks if a group exists on the chef server

Parameters:username – The Group’s groupname
Returns:If the group exists
Return type:boolean
classmethod get(groupname)[source]

Fetches a group from the chef server

Note

Chef returns a slightly different format to what it expects for create/update groups.

Parameters:groupname (string) – The Group’s name
Returns:The chef group and members
Return type:hash
classmethod index()[source]

Fetches all of the groups on the chef server

Returns:All the chef groups with a url for each group
Return type:hash
classmethod update(groupname, group)[source]

Updates a group on the chef server

the group hash should be in the same format as for create

Parameters:
  • groupname (string) – The Group’s groupname
  • group (hash) – The Group members and content
Returns:

The groupname and url

Return type:

hash