Available Methods

client Module

class gandalf.client.GandalfClient(host, port, client)[source]
get_body(response)[source]
get_code(response)[source]
get_content(response)[source]
get_raw(response)[source]
healthcheck(*args, **kwargs)
hook_add(*args, **kwargs)
repository_archive(*args, **kwargs)
repository_branches(*args, **kwargs)
repository_commit(*args, **kwargs)
repository_contents(*args, **kwargs)
repository_delete(*args, **kwargs)
repository_diff_commits(*args, **kwargs)
repository_get(*args, **kwargs)
repository_grant(*args, **kwargs)
repository_log(*args, **kwargs)
repository_new(*args, **kwargs)
repository_revoke(*args, **kwargs)
repository_tags(*args, **kwargs)
repository_tree(*args, **kwargs)
repository_update(*args, **kwargs)
user_add_key(*args, **kwargs)
user_delete(*args, **kwargs)
user_delete_key(*args, **kwargs)
user_get_keys(*args, **kwargs)
user_new(*args, **kwargs)

repository_grant

Grant access to users in repositories

Arguments:

  • users: List of users to grant accesss
  • repositories: List of repositories to grant users acesss

Example:

gandalf.repository_grant(['rfloriano'], ['project-repository'])

repository_update

Updates repository data

Arguments:

  • repository: List of all users to set accesss

Keywork arguments:

  • users: List of users to replace if set
  • readonlyusers: List of read only users to replace if set
  • ispublic: Set if repository is public (boolean)

Example:

gandalf.repository_update('rfloriano', name='bla-bla', users=['user1@gmail.com'], readonlyusers=[], ispublic=False)

repository_revoke

Revoke access to users in repositories

Arguments:

  • users: List of users to revoke accesss
  • repositories: List of repositories to revoke users acesss

Example:

gandalf.repository_grant(['rfloriano'], ['project-repository'])

repository_archive

Arguments:

  • name: The repository’s name
  • ref: Git reference to file
  • format: The file format

repository_contents

Arguments:

  • name: The repository’s name
  • path: File’s path

repository_delete

Delete a repository

Arguments:

  • name: The repository’s name

Example:

gandalf.repository_delete('project-repository')

repository_log

Returns a list of all commits into repository

Arguments:

  • name: The repository’s name
  • ref: The repository ref (commit, tag or branch)
  • total: The maximum number of items to retrieve
  • path: Path to file or directory to filter log

Example:

gandalf.repository_log(repo_name, 'HEAD', 1, 'README.md')

user_add_key

Add ssh public key to an user

Arguments:

  • name: The username
  • keys: Dictionary of public key to associate with user account (Ie: {‘macbook-key’: ‘ssh-dss my-public-key== f@foo.bar‘})

Example:

gandalf.user_add_key('rfloriano', {'my-ssh-key-another': 'content-of-my-ssh-public-another-key'})

user_get_keys

Get keys from an user

Arguments:

  • name: The username

Example:

gandalf.user_get_keys('rfloriano')

user_delete_key

Delete keys from an user

Arguments:

  • name: The username
  • keyname: The key name to remove (Ie: ‘macbook-key’)

Example:

gandalf.user_delete_key('rfloriano', 'my-ssh-key-another')

user_delete

Delete an user

Arguments:

  • name: The username

Example:

gandalf.user_delete('rfloriano')

hook_add

Add git server hook

Arguments:

  • name: The hook’s name
  • content: Content of hook

healthcheck

Validates if the gandalf server responds to healthcheck.

Example:

assert gandalf.healthcheck()