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

ssh-client: fix merge order of options in run_wfunc (fix usage of mine.get in pillar) #50489

Merged
merged 4 commits into from
Dec 14, 2018

Conversation

ptitdoc
Copy link

@ptitdoc ptitdoc commented Nov 13, 2018

What does this PR do?

pillar.Pillar() is called with options where master_opts options are overwritten (because of dict merge/update order). As a consequence, most saltutil functions are not available in the pillar when salt-ssh client is used.

This PR change the opts merge order selectively based on specific wfunc routines (eg: mine.get, pillar.items ...)

What issues does this PR fix or reference?

#36796
#41025

Previous Behavior

master_opts are overwritten when calling mine.get or pillar.items within salt-ssh client.

master_opts takes precedence when calling mine.get or pillar.items within salt-ssh client.

Tests written?

No

Commits signed with GPG?

No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

…e.get in salt-ssh pillar)

This commit fixe a long standing issue: saltstack#36796

A first attempt to fix it is present in PR saltstack#41025
@ghost ghost requested review from a team November 13, 2018 09:59
Copy link
Contributor

@thatch45 thatch45 left a comment

Choose a reason for hiding this comment

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

This is a very good solution to the issue here, thanks!

log.debug(self.fun+" is a minion centric function")
popts.update(opts_pkg)
else:
log.debug(self.fun+" is a master centric function")
Copy link
Contributor

Choose a reason for hiding this comment

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

Logging should be fixed here:

log.debug('%s is a minion function', self.fun)

salt/client/ssh/__init__.py Outdated Show resolved Hide resolved
salt/client/ssh/__init__.py Show resolved Hide resolved
@cachedout
Copy link
Contributor

@ptitdoc Did you see the feedback here from @isbm? Once those issues are resolved we should be able to merge this. Thanks!

@cachedout
Copy link
Contributor

I went ahead and just made the changes that were requested by @isbm

# Once pillar has been compiled, restore priority of minion opts
if self.fun not in master_centric_funcs:
log.debug('%s is a minion function', self.fun)
popts.update(opts_pkg)
Copy link
Contributor

Choose a reason for hiding this comment

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

@cachedout I am still wondering if we need that popts.update(opts_pkg) first time. This one is a second.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will it do any harm though?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine and it makes sense.

# Once pillar has been compiled, restore priority of minion opts
if self.fun not in master_centric_funcs:
log.debug('%s is a minion function', self.fun)
popts.update(opts_pkg)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine and it makes sense.

@thatch45 thatch45 merged commit 7871353 into saltstack:develop Dec 14, 2018
alexey-zhukovin pushed a commit to alexey-zhukovin/salt that referenced this pull request May 4, 2020
@alexey-zhukovin alexey-zhukovin added the has master-port port to master has been created label May 4, 2020
lkubb added a commit to lkubb/salt that referenced this pull request Oct 30, 2023
s0undt3ch pushed a commit that referenced this pull request Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has master-port port to master has been created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants