Skip to content

Commit

Permalink
New exception for ProjectKey.enable_deploy_key and disable_deploy_key
Browse files Browse the repository at this point in the history
  • Loading branch information
Asher256@users.noreply.github.com authored and Asher256@users.noreply.github.com committed Oct 31, 2016
1 parent fc5c52c commit 61d4cac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gitlab/exceptions.py
Expand Up @@ -75,6 +75,10 @@ class GitlabTransferProjectError(GitlabOperationError):
pass


class GitlabProjectDeployKeyError(GitlabOperationError):
pass


class GitlabCancelError(GitlabOperationError):
pass

Expand Down
4 changes: 2 additions & 2 deletions gitlab/objects.py
Expand Up @@ -1253,13 +1253,13 @@ def enable_deploy_key(self, project_id, key_id):
"""Enable a deploy key for a project."""
url = '/projects/%s/deploy_keys/%s/enable' % (project_id, key_id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)
raise_error_from_response(r, GitlabProjectDeployKeyError, 201)

def disable_deploy_key(self, project_id, key_id):
"""Disable a deploy key for a project."""
url = '/projects/%s/deploy_keys/%s/disable' % (project_id, key_id)
r = self.gitlab._raw_delete(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)
raise_error_from_response(r, GitlabProjectDeployKeyError, 201)


class ProjectKeyManager(BaseManager):
Expand Down

0 comments on commit 61d4cac

Please sign in to comment.