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

Use _remote_is_local=True for local connection in synchronize #40833

Merged
merged 3 commits into from May 30, 2018

Conversation

sivel
Copy link
Member

@sivel sivel commented May 29, 2018

SUMMARY

All instances of local connection should use _remote_is_local=True. Fixes #40551

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/plugins/connection/local.py

ANSIBLE VERSION
2.5.3
2.6
2.7
ADDITIONAL INFORMATION

@sivel sivel requested a review from bcoca May 29, 2018 16:16
@gundalow gundalow requested a review from Qalthos May 29, 2018 16:16
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 29, 2018
@sivel
Copy link
Member Author

sivel commented May 29, 2018

Due to the _remote_is_local functionality extending to _remote_expand_user also, I don't think we can extend this globally to the local connection plugin.

Effectively, we only need to bypass using remote_user to build tmpdir paths.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label May 29, 2018
@sivel
Copy link
Member Author

sivel commented May 29, 2018

Copy link
Contributor

@Qalthos Qalthos left a comment

Choose a reason for hiding this comment

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

+1 either way

@sivel sivel changed the title All instances of local connection should use _remote_is_local=True Use _remote_is_local=True for local connection in synchronize May 30, 2018
@ansibot ansibot added the test This PR relates to tests. label May 30, 2018
@@ -246,3 +250,15 @@ def test_delegate_remote_su(self):
# delegate to other remote host with su enabled
x = SynchronizeTester()
x.runtest(fixturepath=os.path.join(self.fixturedir, 'delegate_remote_su'))

@patch.object(ActionModule, '_low_level_execute_command', side_effect=BreakPoint)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like it works fine, but the side_effect=BreakPoint here seems superfluous. Am I missing something?

Copy link
Member

Choose a reason for hiding this comment

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

... or is that just to get it to bail out on that call?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm short circuiting the execution of run by setting a side_effect on a function call that will actually connect to the server to expand the path. Otherwise it will try and go further, actually executing the module.

This allows me to kill execution immediately after what we are wanting to inspect.

Copy link
Member Author

Choose a reason for hiding this comment

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

... or is that just to get it to bail out on that call?

Exactly that.

Copy link
Member

Choose a reason for hiding this comment

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

Cool

@nitzmahone
Copy link
Member

rebuild_merge

@nitzmahone
Copy link
Member

unrelated transient CI failure - merging

@nitzmahone nitzmahone merged commit ad7ba91 into ansible:devel May 30, 2018
sivel added a commit to sivel/ansible that referenced this pull request May 30, 2018
…e#40833)

* All instances of local connection should use _remote_is_local=True. Fixes ansible#40551

* Switch to instance attribute for synchronize

* Add test that shows that synchronize _remote_is_local addresses tmpdir building

(cherry picked from commit ad7ba91)
sivel added a commit to sivel/ansible that referenced this pull request May 30, 2018
sivel added a commit to sivel/ansible that referenced this pull request May 30, 2018
…e#40833)

* All instances of local connection should use _remote_is_local=True. Fixes ansible#40551

* Switch to instance attribute for synchronize

* Add test that shows that synchronize _remote_is_local addresses tmpdir building

(cherry picked from commit ad7ba91)
sivel added a commit to sivel/ansible that referenced this pull request May 30, 2018
ansibot pushed a commit that referenced this pull request May 30, 2018
* Use _remote_is_local=True for local connection in synchronize (#40833)

* All instances of local connection should use _remote_is_local=True. Fixes #40551

* Switch to instance attribute for synchronize

* Add test that shows that synchronize _remote_is_local addresses tmpdir building

(cherry picked from commit ad7ba91)

* Add changelog entry for #40833
sivel added a commit that referenced this pull request May 30, 2018
* Use _remote_is_local=True for local connection in synchronize (#40833)

* All instances of local connection should use _remote_is_local=True. Fixes #40551

* Switch to instance attribute for synchronize

* Add test that shows that synchronize _remote_is_local addresses tmpdir building

(cherry picked from commit ad7ba91)

* Add changelog entry for #40833
jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
…e#40833)

* All instances of local connection should use _remote_is_local=True. Fixes ansible#40551

* Switch to instance attribute for synchronize

* Add test that shows that synchronize _remote_is_local addresses tmpdir building
@ansible ansible locked and limited conversation to collaborators May 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

synchronize uses remote_user to build local tmpdir
5 participants