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

Port #50489 to master #57076

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,19 @@ def run_wfunc(self):
opts_pkg["grains"][grain] = self.target["grains"][grain]

popts = {}
popts.update(opts_pkg["__master_opts__"])
popts.update(opts_pkg)

# Master centric operations such as mine.get must have master option loaded.
# The pillar must then be compiled by passing master opts found in opts_pkg['__master_opts__']
# which causes the pillar renderer to loose track of salt master options
#
# Depending on popts merge order, it will overwrite some options found in opts_pkg['__master_opts__']
master_centric_funcs = ["pillar.items", "mine.get"]

# Pillar compilation is a master centric operation.
# Master options take precedence during Pillar compilation
popts.update(opts_pkg["__master_opts__"])

pillar = salt.pillar.Pillar(
popts,
opts_pkg["grains"],
Expand All @@ -1172,6 +1183,13 @@ def run_wfunc(self):
)
pillar_data = pillar.compile_pillar()

# 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)
else:
log.debug("%s is a master function", self.fun)

# TODO: cache minion opts in datap in master.py
data = {
"opts": opts_pkg,
Expand Down