-
Notifications
You must be signed in to change notification settings - Fork 145
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
Fixes metadata format for 'ssh-keys' key #455
Conversation
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
===========================================
- Coverage 88.86% 66.79% -22.07%
===========================================
Files 339 249 -90
Lines 5629 4258 -1371
===========================================
- Hits 5002 2844 -2158
- Misses 627 1414 +787
Continue to review full report at Codecov.
|
@Temikus, |
@kgaikwad PTAL at my comments in #454 While this would make the keys work with your key format, it will most likely break it for others, as if someone just reads off a key generated by
, which would be invalid. If you want to proceed with this PR (for example some library/util gives you an ssh key without postfix) - you'll need to make the statement conditional. E.g. if the key doesn't have the username at the end, add it. Makes sense? |
As much as I hate adding new dependencies, we could use something like https://github.com/bensie/sshkey to parse incoming keys and add a comment if one was missing. |
@icco Using a full-blown generator lib to parse keys would IMO be overkill. TBH I think just notifying of the correct format would suffice, as the problem is with the API accepting something that the console can’t parse. Or am I missing something here? |
I also agree with @Temikus. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is worth a while to use proper parser for validating correct format of the key, or at least document the supported formats. That being said, we could just easily add the comment part only if missing...
Thank you @ezr-ondrej for review. It would be good if we document those formats but in google document, these details are already present. |
I would prefer to use an external parser, especially one as lightweight as
what was suggested. We had it a long time ago but removed it when they
dropped 1.8 support before we did, iirc.
…On Fri, May 31, 2019, 07:23 kgaikwad ***@***.***> wrote:
I believe it is worth a while to use proper parser for validating correct
format of the key, or at least document the supported formats. That being
said, we could just easily add the comment part only if missing...
Thank you @ezr-ondrej <https://github.com/ezr-ondrej> for review.
Yeah, this is what we have discussed to add username only if comment is
absent.
If everyone agree on adding a parser and raising an error for invalid
format then I will happy to add your suggested changes.
It would be good if we document those formats but in google document
<https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys>,
these details are already present.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#455?email_source=notifications&email_token=AAAE52JXAQKIVSE2KF4YRWTPYEDEVA5CNFSM4HF7WDZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWU6VIY#issuecomment-497674915>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAE52NRMG5PYPINDMBLOZTPYEDEVANCNFSM4HF7WDZA>
.
|
f2998e6
to
a8a26c1
Compare
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
+ Coverage 88.86% 88.86% +<.01%
==========================================
Files 339 339
Lines 5629 5633 +4
==========================================
+ Hits 5002 5006 +4
Misses 627 627
Continue to review full report at Codecov.
|
Updated PR! I will squash changes to single commit once ready for merge. Though comment field is optional one, in document it clearly states that public-key should match format: Please let me know if I am missing anything or are there any places where it is needed? |
I guess it is good enough. As the method is pretty small and straight forward, I guess we do not need to use external library to achieve the same thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change
a8a26c1
to
261e959
Compare
Thank you @ezr-ondrej and @icco! Updated PR as per suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks @kgaikwad, LGTM
What do you think @Temikus ? |
@kgaikwad @ezr-ondrej LGTM overall, thank you! 😃 One small request, is it possible to add a test for this? I'm asking since all the integrations I maintain do not use this so I want to make sure we don't break your use-case down the road. It should be super-trivial - just add a test method to https://github.com/fog/fog-google/blob/master/test/integration/compute/core_compute/test_servers.rb Something like:
If you don't have time for it I understand. Just give me an example of your interaction and how you generate the key so I can add one later. |
@Temikus, thank you for merging this change and sorry for delay in response. I will create pull-request which will add small test as you suggested. |
Closes #454