Users

Wraps the chef user account. In order to modify users in chef you will need server admin privledges. Server admins are supported in chef 12.4.1 and above. If you are using an older version of chef server you will have to use the pivotal user (not recommended) to be able to modify users. More info on chef server admins can be found in the chef server admins documentation.

Supported Operations

Index Fetch a list of all of the users
Get Lookup user info
Create Create a new user
Update Update a group
Delete Delete a group
Exists Check if a user exists
Invite Invite a user to an org

API Reference

class pastry.resources.users.Users[source]

Provides access to the chef users resource

classmethod create(user)[source]

Creates a new chef user on the server

The user hash should be in the form:

{
    'username': <username>,
    'display_name': <display_name>,
    'first_name': <first name>,
    'middle_name': <middle name>, # optional
    'last_name': <last name>,
    'email': <email>,
    'password': <password>
}
Parameters:user (hash) – The user to create
Returns:The username and url
Return type:hash
classmethod delete(username)[source]

Deletes a user from the chef server

Parameters:username – The User’s username
Returns:The deleted user’s name
Return type:hash
classmethod exists(username)[source]

Checks if a user exists on the chef server

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

Fetches a user from the chef server

Parameters:username (string) – The User’s username
Returns:The chef user
Return type:hash
classmethod index()[source]

Fetches all of the users on the chef server

Returns:All the chef users with a url for each user
Return type:hash
classmethod invite(username, orgname)[source]

Invite a user to an org

Parameters:
  • username (string) – The User’s username
  • orgname (string) – The chef organization
Returns:

If the request was successful

Return type:

boolean

classmethod update(username, user)[source]

Updates a user on the chef server

Parameters:
  • username (string) – The User’s username
  • user (hash) – The User members and content
Returns:

The username and url

Return type:

hash