Ensure initial _sync_grains only occurs if masterless minion in class SMinion initialization

This commit is contained in:
David Murphy 2023-12-20 10:14:37 -07:00 committed by Daniel Wozniak
parent 048028466a
commit 4a8908cd11
2 changed files with 4 additions and 2 deletions

1
changelog/65692.fixed.md Normal file
View file

@ -0,0 +1 @@
Ensure initial _sync_grains only occurs if masterless minion in class SMinion initialization

View file

@ -116,7 +116,8 @@ log = logging.getLogger(__name__)
def _sync_grains(opts):
# need sync of custom grains as may be used in pillar compilation
# if coming up initially and remote client, the first sync _grains
# if coming up initially and local client (masterless minion)
# if local client (masterless minion), the first sync _grains
# doesn't have opts["master_uri"] set yet during the sync, so need
# to force local, otherwise will throw an exception when attempting
# to retrieve opts["master_uri"] when retrieving key for remote communication
@ -129,7 +130,7 @@ def _sync_grains(opts):
if opts.get("extmod_blacklist", None) is None:
opts["extmod_blacklist"] = {}
if opts.get("file_client", "remote") == "remote" and not opts.get(
if opts.get("file_client", "remote") == "local" and not opts.get(
"master_uri", None
):
salt.utils.extmods.sync(opts, "grains", force_local=True)