-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
…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
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.
This is a very good solution to the issue here, thanks!
salt/client/ssh/__init__.py
Outdated
log.debug(self.fun+" is a minion centric function") | ||
popts.update(opts_pkg) | ||
else: | ||
log.debug(self.fun+" is a master centric function") |
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.
Logging should be fixed here:
log.debug('%s is a minion function', self.fun)
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) |
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.
@cachedout I am still wondering if we need that popts.update(opts_pkg)
first time. This one is a second.
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.
Will it do any harm though?
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.
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) |
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.
I think this is fine and it makes sense.
This also ports saltstack#50489 into the present
This also ports #50489 into the present
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.