mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
Ensure sync from _grains occurs before attempting pillar compilation in case custom grain used in pillar file
This commit is contained in:
parent
862ca146a1
commit
639ec023f1
3 changed files with 7 additions and 1 deletions
1
changelog/65027.fixed.md
Normal file
1
changelog/65027.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Ensure sync from _grains occurs before attempting pillar compilation in case custom grain used in pillar file
|
|
@ -73,6 +73,7 @@ from salt.template import SLS_ENCODING
|
|||
from salt.utils.ctx import RequestContext
|
||||
from salt.utils.debug import enable_sigusr1_handler
|
||||
from salt.utils.event import tagify
|
||||
from salt.utils.extmods import sync as _sync
|
||||
from salt.utils.network import parse_host_port
|
||||
from salt.utils.odict import OrderedDict
|
||||
from salt.utils.process import ProcessManager, SignalHandlingProcess, default_signals
|
||||
|
@ -920,6 +921,8 @@ class SMinion(MinionBase):
|
|||
# Late setup of the opts grains, so we can log from the grains module
|
||||
import salt.loader
|
||||
|
||||
# need sync of custom grains as may be used in pillar compilation
|
||||
_sync(opts, "grains")
|
||||
opts["grains"] = salt.loader.grains(opts)
|
||||
super().__init__(opts)
|
||||
|
||||
|
@ -3936,6 +3939,8 @@ class SProxyMinion(SMinion):
|
|||
|
||||
salt '*' sys.reload_modules
|
||||
"""
|
||||
# need sync of custom grains as may be used in pillar compilation
|
||||
_sync(self.opts, "grains")
|
||||
self.opts["grains"] = salt.loader.grains(self.opts)
|
||||
self.opts["pillar"] = salt.pillar.get_pillar(
|
||||
self.opts,
|
||||
|
|
|
@ -4254,7 +4254,7 @@ class BaseHighState:
|
|||
"""
|
||||
if not self.opts["autoload_dynamic_modules"]:
|
||||
return
|
||||
syncd = self.state.functions["saltutil.sync_all"](list(matches), refresh=False)
|
||||
syncd = self.state.functions["saltutil.sync_all"](list(matches), refresh=True)
|
||||
if syncd["grains"]:
|
||||
self.opts["grains"] = salt.loader.grains(self.opts)
|
||||
self.state.opts["pillar"] = self.state._gather_pillar()
|
||||
|
|
Loading…
Add table
Reference in a new issue