-
Notifications
You must be signed in to change notification settings - Fork 53
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
(feat) Add ssh key support to abs ssh transport #182
(feat) Add ssh key support to abs ssh transport #182
Conversation
Allows for an ABS_SSH_PRIVATE_KEY env variable to provide a path to a local private key for the inventory ssh config rather than a password credential. Prefers ABS_SSH_PRIVATE_KEY if present. This allows us to use ssh keys to reach abs hosts in CI.
@binford2k do you have anyone that should take a look at this? |
Hi @jpartlow, I had a look on the PR and it looks good, I'll merge it now, thank you! |
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 think this PR just broke provision when ABS_SSH_PRIVATE_KEY
is unset.
'facts' => { 'provisioner' => 'abs', 'platform' => host['type'], 'job_id' => job_id } } | ||
if !ENV['ABS_SSH_PRIVATE_KEY'].empty? |
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.
@jpartlow this throws an error when the environment variable is unset.
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.
This happens when merging goes fast forward. We need to come with a proper fix in order to avoid blocking errors.
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.
Should we revert or fix?
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.
Fix at #185.
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.
The abs.rb is refactored into a class that is executed only if the task file is the executing program. This allows the spec to load the task and manipulate the class while mocking externals. The webmock gem is used to provide HTTP::Net mocking. The spec is not exhaustive, but hopefully covers enough to validate that the refactor didn't break the task, and that the bug I added in puppetlabs#182 is patched. It could be expanded, and could serve as a template for adding specs for other tasks in the module. It does look to expose an edge case bug of calling the provision task with an inventory directory specified that contains a pre-existing inventory file.
The abs.rb is refactored into a class that is executed only if the task file is the executing program. This allows the spec to load the task and manipulate the class while mocking externals. The webmock gem is used to provide HTTP::Net mocking. The spec is not exhaustive, but hopefully covers enough to validate that the refactor didn't break the task, and that the bug I added in puppetlabs#182 is patched. It could be expanded, and could serve as a template for adding specs for other tasks in the module. It does look to expose an edge case bug of calling the provision task with an inventory directory specified that contains a pre-existing inventory file.
The abs.rb is refactored into a class that is executed only if the task file is the executing program. This allows the spec to load the task and manipulate the class while mocking externals. The webmock gem is used to provide HTTP::Net mocking. The spec is not exhaustive, but hopefully covers enough to validate that the refactor didn't break the task, and that the bug I added in puppetlabs#182 is patched. It could be expanded, and could serve as a template for adding specs for other tasks in the module. It does look to expose an edge case bug of calling the provision task with an inventory directory specified that contains a pre-existing inventory file.
The abs.rb is refactored into a class that is executed only if the task file is the executing program. This allows the spec to load the task and manipulate the class while mocking externals. The webmock gem is used to provide HTTP::Net mocking. The spec is not exhaustive, but hopefully covers enough to validate that the refactor didn't break the task, and that the bug I added in puppetlabs#182 is patched. It could be expanded, and could serve as a template for adding specs for other tasks in the module. It does look to expose an edge case bug of calling the provision task with an inventory directory specified that contains a pre-existing inventory file.
Allows for an ABS_SSH_PRIVATE_KEY env variable to provide a path to a
local private key for the inventory ssh config rather than a password
credential. Prefers ABS_SSH_PRIVATE_KEY if present.
This allows us to use ssh keys to reach abs hosts in CI.
I've been testing with my branch here:
https://github.com/puppetlabs/kurl_test/pull/47/files#diff-e6ffa5dc854b843b3ee3c3c28f8eae2f436c2df2b1ca299cca1fa5982e390cf8R36