Skip to content

Commit 6bedfc3

Browse files
Asher256@users.noreply.github.comAsher256@users.noreply.github.com
Asher256@users.noreply.github.com
authored and
Asher256@users.noreply.github.com
committed
Project deploy key response code = 201
1 parent 72d982b commit 6bedfc3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

gitlab/objects.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1249,21 +1249,21 @@ class ProjectKey(GitlabObject):
12491249
requiredUrlAttrs = ['project_id']
12501250
requiredCreateAttrs = ['title', 'key']
12511251

1252+
1253+
class ProjectKeyManager(BaseManager):
1254+
obj_cls = ProjectKey
1255+
12521256
def enable(self, key_id):
12531257
"""Enable a deploy key for a project."""
1254-
url = '/projects/%s/deploy_keys/%s/enable' % (self.project_id, key_id)
1258+
url = '/projects/%s/deploy_keys/%s/enable' % (self.parent.id, key_id)
12551259
r = self.gitlab._raw_post(url)
1256-
raise_error_from_response(r, GitlabProjectDeployKeyError, 200)
1260+
raise_error_from_response(r, GitlabProjectDeployKeyError, 201)
12571261

12581262
def disable(self, key_id):
12591263
"""Disable a deploy key for a project."""
1260-
url = '/projects/%s/deploy_keys/%s/disable' % (self.project_id, key_id)
1264+
url = '/projects/%s/deploy_keys/%s/disable' % (self.parent.id, key_id)
12611265
r = self.gitlab._raw_delete(url)
1262-
raise_error_from_response(r, GitlabProjectDeployKeyError, 200)
1263-
1264-
1265-
class ProjectKeyManager(BaseManager):
1266-
obj_cls = ProjectKey
1266+
raise_error_from_response(r, GitlabProjectDeployKeyError, 201)
12671267

12681268

12691269
class ProjectEvent(GitlabObject):

0 commit comments

Comments
 (0)