Skip to content
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

add "ssh-key get --project-id $ID" #156

Merged
merged 1 commit into from
Sep 26, 2022
Merged

add "ssh-key get --project-id $ID" #156

merged 1 commit into from
Sep 26, 2022

Conversation

displague
Copy link
Member

@displague displague commented Oct 6, 2021

This PR add support for listing ssh-keys in a given project.

metal ssh-keys get -P 

@displague
Copy link
Member Author

displague commented Jul 23, 2022

Previous description:

This PR, as drafted, introduces a bug because the project-id from ~/.config/equinix/metal.yaml will always be defined.
A user will therefor not be able to get user ssh-keys, they can only get project ssh keys.

Stated another way, project id is defined by viper from config args. This is preventing the ssh-key get from defining project id.

Possible solutions:

  • use a different variable name for project selection (metal ssh-key get --project --project-id {id})
  • use a different action name for user or project ssh key listing (metal project ssh-keys, metal ssh-key project-get)
  • default to project listing and only attempt user ssh-key listing in the presence of a new argument (metal ssh-key get --user)
  • find a way to ignore the project-id defined by viper (metal ssh-key get --project-id $id (ignoring the viper defined project-id))

I went with the first option, but expanded --project to --project-ssh-keys (with short flag -P):
metal ssh-key get --project-ssh-keys --project-id {id}

Since metal init sets a default project, metal ssh-keys get -P will list project ssh keys for the configured project.

@displague displague marked this pull request as ready for review July 23, 2022 18:56
@displague displague requested a review from cprivitere July 23, 2022 18:58
@displague displague merged commit f6c65ae into main Sep 26, 2022
@displague displague deleted the ssh-project branch September 26, 2022 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant