-
Notifications
You must be signed in to change notification settings - Fork 285
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 optional keyfile argument to rake tasks #150
Conversation
This addition walks over any extra arguments provided to the rake task. If the file is a key file, it is used to set the BEAKER_keyfile ENVIRONMENT variable for beaker-rspec and/or the `--keyfile` command line argument for beaker as needed. Example: BEAKER_setfile=../vcenterhost.cfg rake beaker:rspec:test[foo,pe,'/home/myuser/.ssh/id_rsa-secret']
|
Can you include the expected usage for this task here? |
|
Example added to comment. :) |
| def check_args_for_keyfile(extra_args) | ||
| keyfile = '' | ||
| extra_args.each do |a| | ||
| keyfile = a if (`file -b #{a}`.gsub(/\n/,"").match(/ key/)) |
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 don't grok what this is doing
When I run that command against a private key locally I get:
sellout:~ justin$ file -b .ssh/id_rsa-acceptance
ASCII textand when I run it against a public key I get:
sellout:~ justin$ file -b thing.key
ASCII text, with very long lines|
Why not add the environment variable directly, by running rake like this: rake beaker:rspec:test \
BEAKER_setfile=../vcenterhost.cfg \
BEAKER_keyfile=/home/myuser/.ssh/id_rsa-secret |
|
@sodabrew The ENV var works for beaker-rspec but currently, vanilla beaker only accepts the keyfile as a command line flag. |
|
@justinstoller I have updated the logic for validating the keyfile |
|
Copy the env var to the command line flags array in code. This makes it deterministic instead of relying on |
|
The way it is done is to make it able to call beaker or beaker-rspec in the way that most closely follows their usage pattern, and beaker doesn't officially support the |
Add optional keyfile argument to rake tasks
Add optional keyfile argument to rake tasks
This addition walks over any extra arguments provided to the
rake task. If the file is a key file, it is used to set the
BEAKER_keyfile ENVIRONMENT variable for beaker-rspec and/or
the
--keyfilecommand line argument for beaker as needed.Example:
BEAKER_setfile=../vcenterhost.cfg rake beaker:rspec:test[foo,pe,'/home/myuser/.ssh/id_rsa-secret']