-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
git modules reports missing https password clearly #71898
Conversation
Based on this comment it seems that setting |
We also need a changelog entry and integration tests. |
I tested with more git versions now. $ GIT_TERMINAL_PROMPT=0 git fetch
fatal: could not read Password for 'https://MyUser@github.com': terminal prompts disabled
$ echo returned $?
returned 128 So for old versions, we have to set |
I need some guidance. Where do I put the changelog? |
lib/ansible/modules/git.py
Outdated
@@ -1163,6 +1163,8 @@ def main(): | |||
# We screenscrape a huge amount of git commands so use C locale anytime we | |||
# call run_command() | |||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C', LC_CTYPE='C') | |||
if 'GIT_TERMINAL_PROMPT' not in os.environment: |
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.
Oops, the variable name is os.environ (ment)
Changelog fragments go in
Yes, the new test would go in The test would need to set the - name: Test failure with GIT_ASKPASS (EXPECTED FAILURE)
git:
repo: https://someprivate.repo
dest: "{{ checkout_dir }}"
environment:
GIT_ASKPASS: /bin/false
register: result1
- name: Test failure with GIT_ASKPASS (EXPECTED FAILURE)
git:
repo: https://someprivate.repo
dest: "{{ checkout_dir }}"
register: result2
- assert:
that:
- result2 is failed |
The more I think about this, this would be a change in behavior that may affect some who are relying on this interactive capability in the module. It's probably uncommon, but I believe AWX is relying on this. This should probably be a new option or an update to the documentation with an example task that shows how to set |
* older git versions do not know GIT_TERMINAL_PROMPT, so use GIT_ASKPASS * use correct variable name os.environ
Whoever wants the interactive functionality can set Having a clear documentation (without this change) would also be a big plus to now, because this info is only found in a bug report. |
The test
|
TODO:
|
I think this should be a documentation change. It can be added to the |
so what about pullrequest #72164 ? |
Fixed by #72164 |
SUMMARY
git module reports missing https password instead of hanging
fixes #69489
ISSUE TYPE
COMPONENT NAME
git
ADDITIONAL INFORMATION
Asking for the ssh password is prevented on Line411 by setting
-o BatchMode=yes
for ssh. To do the same for https, we can set an environment variable. Not sure if it is done in the correct place.