Skip to content
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

fix git wrapper #29069

Merged
merged 3 commits into from Sep 15, 2017
Merged

fix git wrapper #29069

merged 3 commits into from Sep 15, 2017

Conversation

bcoca
Copy link
Member

@bcoca bcoca commented Sep 6, 2017

SUMMARY

Fixes issue with git on noexec when forced to use the ssh wrapper it can write on demand.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

git

ANSIBLE VERSION
2.4

@bcoca
Copy link
Member Author

bcoca commented Sep 6, 2017

cc @abadger

@ansibot
Copy link
Contributor

ansibot commented Sep 6, 2017

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bugfix_pull_request core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 6, 2017
@abadger
Copy link
Contributor

abadger commented Sep 6, 2017 via email

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Sep 6, 2017
@abadger
Copy link
Contributor

abadger commented Sep 8, 2017

@plamer ping, are you able to test this? I'd like to see this go into 2.4.0 for which rc1 has already gone out. So we're closing in on the time when we'd have to punt this to a later release.

os.environ["GIT_SSH"] = ssh_wrapper
# using shell to avoid 'noexec' issues if module temp dir is located in such a mount
os.environ["GIT_SSH_COMMAND"] = ' '.join([os.environ.get('SHELL', '/bin/sh'), ssh_wrapper])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The join here seems a little unnecessary, and the performance is worse than a printf like string format or using .format

Although it is just 1 line, and not repeated, so that's just a little bit of a nitpick.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use percent formatting

@@ -371,9 +371,10 @@ def write_ssh_wrapper():

def set_git_ssh(ssh_wrapper, key_file, ssh_opts):

if os.environ.get("GIT_SSH"):
del os.environ["GIT_SSH"]
# git_ssh_command will override git_ssh, so only older git needs it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I see GIT_SSH_COMMAND was only introduced in git 2.3, so this change will not fix the issue on many systems, including rhel7.

@bcoca bcoca merged commit f8005d2 into ansible:devel Sep 15, 2017
@bcoca bcoca deleted the git_wrapper_fix branch September 15, 2017 03:27
prasadkatti pushed a commit to prasadkatti/ansible that referenced this pull request Oct 1, 2017
* fix git wrapper

* fallback to bin/sh

* Use percent formatting as per sivel's review
bcoca added a commit to bcoca/ansible that referenced this pull request Oct 4, 2017
This reverts commit f8005d2.

fix needs to be rethought as it applies to only newer git versions
and use of env shell breaks with non 'bourne compatible' shells
abadger pushed a commit that referenced this pull request Oct 4, 2017
This reverts commit f8005d2.

fix needs to be rethought as it applies to only newer git versions
and use of env shell breaks with non 'bourne compatible' shells
BondAnthony pushed a commit to BondAnthony/ansible that referenced this pull request Oct 5, 2017
* fix git wrapper

* fallback to bin/sh

* Use percent formatting as per sivel's review
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants