Skip to content

Commit

Permalink
Merge pull request saltstack#36387 from sjmh/fix/minion_cache_publish
Browse files Browse the repository at this point in the history
Fix/minion cache publish
  • Loading branch information
Mike Place authored Sep 17, 2016
2 parents 73ee12e + 6752191 commit c0dffdf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 17 additions & 12 deletions salt/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,14 @@ def publish(self, clear_load):
)
return ''

# Retrieve the minions list
delimiter = clear_load.get('kwargs', {}).get('delimiter', DEFAULT_TARGET_DELIM)
minions = self.ckminions.check_minions(
clear_load['tgt'],
clear_load.get('tgt_type', 'glob'),
delimiter
)

# Check for external auth calls
if extra.get('token', False):
# A token was passed, check it
Expand Down Expand Up @@ -2041,7 +2049,8 @@ def publish(self, clear_load):
clear_load['fun'],
clear_load['arg'],
clear_load['tgt'],
clear_load.get('tgt_type', 'glob'))
clear_load.get('tgt_type', 'glob'),
minions=minions)
if not good:
# Accept find_job so the CLI will function cleanly
if clear_load['fun'] != 'saltutil.find_job':
Expand Down Expand Up @@ -2138,7 +2147,8 @@ def publish(self, clear_load):
clear_load['fun'],
clear_load['arg'],
clear_load['tgt'],
clear_load.get('tgt_type', 'glob')
clear_load.get('tgt_type', 'glob'),
minions=minions
)
if not good:
# Accept find_job so the CLI will function cleanly
Expand Down Expand Up @@ -2170,7 +2180,8 @@ def publish(self, clear_load):
clear_load['fun'],
clear_load['arg'],
clear_load['tgt'],
clear_load.get('tgt_type', 'glob'))
clear_load.get('tgt_type', 'glob'),
minions=minions)
if not good:
# Accept find_job so the CLI will function cleanly
if clear_load['fun'] != 'saltutil.find_job':
Expand Down Expand Up @@ -2215,7 +2226,8 @@ def publish(self, clear_load):
clear_load['fun'],
clear_load['arg'],
clear_load['tgt'],
clear_load.get('tgt_type', 'glob'))
clear_load.get('tgt_type', 'glob'),
minions=minions)
if not good:
# Accept find_job so the CLI will function cleanly
if clear_load['fun'] != 'saltutil.find_job':
Expand All @@ -2235,14 +2247,7 @@ def publish(self, clear_load):
'Authentication failure of type "other" occurred.'
)
return ''
# FIXME Needs additional refactoring
# Retrieve the minions list
delimiter = clear_load.get('kwargs', {}).get('delimiter', DEFAULT_TARGET_DELIM)
minions = self.ckminions.check_minions(
clear_load['tgt'],
clear_load.get('tgt_type', 'glob'),
delimiter
)

# If we order masters (via a syndic), don't short circuit if no minions
# are found
if not self.opts.get('order_masters'):
Expand Down
2 changes: 2 additions & 0 deletions salt/utils/minions.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,8 @@ def validate_tgt(self, valid, expr, expr_form, minions=None):
v_minions = self._expand_matching(valid)
if minions is None:
minions = set(self.check_minions(expr, expr_form))
else:
minions = set(minions)
d_bool = not bool(minions.difference(v_minions))
if len(v_minions) == len(minions) and d_bool:
return True
Expand Down

0 comments on commit c0dffdf

Please sign in to comment.