Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.

Ask password to user when not provided#6

Merged
duncanhall merged 5 commits intotrainline:masterfrom
alefranz:getpass
May 8, 2017
Merged

Ask password to user when not provided#6
duncanhall merged 5 commits intotrainline:masterfrom
alefranz:getpass

Conversation

@alefranz
Copy link
Contributor

Currently the password need to be provided in clear or set in clear as environment variable.

This adds getpass to ask the password to the user without outputting it.
This happen only if the password is not set and is not running in CI mode.

Also includes the Contributor Agreement.

Use getpass to ask the password to the user without outputting it.
This happen only if the password is not set and is not running in CI mode.
@duncanhall
Copy link
Contributor

Thanks, this looks like a sensible solution. Could you add a test in here to check that getpass is called as expected.

@duncanhall
Copy link
Contributor

@alefranz Let me know if you need help adding tests?

@alefranz
Copy link
Contributor Author

alefranz commented May 6, 2017

Hi @duncanhall, sorry for the delay.
I've added a test to verify getpass is called when required (that is not called in the other case seems unnecessary to test as if that was the case all tests would be failing as it is not mocked out).
I haven't seen any test around environment variables. Please let me know if I had missed something.

@duncanhall
Copy link
Contributor

@alefranz There's an issue here with running the tests on a machine that does have the password set as an environment variable (eg, my local machine). In this case, getpass is never called and the test fails.

If you can add permissions for me to commit to your fork I'll submit an update to fix this.

@duncanhall duncanhall merged commit d7f9749 into trainline:master May 8, 2017
@duncanhall
Copy link
Contributor

duncanhall commented May 8, 2017

Will get this released later today. Thanks for this, It's a good alternative to having passwords in plain text, I'm sure many will find it useful. 🔥 👍

@duncanhall
Copy link
Contributor

duncanhall commented May 8, 2017

Released in 1.9.0

@alefranz
Copy link
Contributor Author

alefranz commented May 9, 2017

@duncanhall Thanks for taking the time of fixing the tests and merging this PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants