Skip to content

Enable an existing deploy key #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smelchior opened this issue Dec 20, 2016 · 4 comments
Closed

Enable an existing deploy key #196

smelchior opened this issue Dec 20, 2016 · 4 comments
Labels

Comments

@smelchior
Copy link

Currently i can only disable / enable deploykeys that have been created with the project. I have an existing deploy key that is already in use in other projects which i want to enable. But i get an exception in that case:
gitlabProject.keys.enable(12)

AttributeError: 'ProjectKeyManager' object has no attribute 'enable'

Is there a way to make this possible?

@gpocentek
Copy link
Contributor

At the moment you need to retrieve the key, then use its enable method:

key = gitlabProject.keys.get(12)
key.enable() 

No enable method exist on the manager object (keys in your example).

@smelchior
Copy link
Author

Sorry for getting back so late.
I tried your suggestion, but gitlab will give me a 404 error for for this:

key = gitlabProject.keys.get(12)

The request generated is:

/api/v3/projects/1/keys/12?project_id=1

The with that id is present, just not used in that project yet

@lordi
Copy link

lordi commented Feb 3, 2017

I do think this is broken currently. There seems to be no way to enable a deploy key for a project. I'm also getting a 404 on .get().

@smelchior
Copy link
Author

I guess the get call for the key is not really supported for the gitlab api. The only way to do it seems to be:
https://docs.gitlab.com/ee/api/deploy_keys.html#enable-a-deploy-key
which would map to:
gitlabProject.keys.enable(12)
but that is not working due to the exception:
AttributeError: 'ProjectKeyManager' object has no attribute 'enable'

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants