diff --git a/salt/matchers/pillar_exact_match.py b/salt/matchers/pillar_exact_match.py index 47688fc6d844..564f5c04ffec 100644 --- a/salt/matchers/pillar_exact_match.py +++ b/salt/matchers/pillar_exact_match.py @@ -22,7 +22,12 @@ def match(tgt, delimiter=':', opts=None): 'statement from master') return False - return salt.utils.data.subdict_match(opts['pillar'], - tgt, - delimiter=delimiter, - exact_match=True) + if 'pillar' in opts: + pillar = opts['pillar'] + elif 'ext_pillar' in opts: + log.info('No pillar found, fallback to ext_pillar') + pillar = opts['ext_pillar'] + + return salt.utils.data.subdict_match( + pillar, tgt, delimiter=delimiter, exact_match=True + ) diff --git a/salt/matchers/pillar_match.py b/salt/matchers/pillar_match.py index 77639d84407c..32d681130fe0 100644 --- a/salt/matchers/pillar_match.py +++ b/salt/matchers/pillar_match.py @@ -22,6 +22,13 @@ def match(tgt, delimiter=DEFAULT_TARGET_DELIM, opts=None): log.error('Got insufficient arguments for pillar match ' 'statement from master') return False + + if 'pillar' in opts: + pillar = opts['pillar'] + elif 'ext_pillar' in opts: + log.info('No pillar found, fallback to ext_pillar') + pillar = opts['ext_pillar'] + return salt.utils.data.subdict_match( - opts['pillar'], tgt, delimiter=delimiter + pillar, tgt, delimiter=delimiter ) diff --git a/salt/matchers/pillar_pcre_match.py b/salt/matchers/pillar_pcre_match.py index 4dbaca0363bf..3fbf0e6f9419 100644 --- a/salt/matchers/pillar_pcre_match.py +++ b/salt/matchers/pillar_pcre_match.py @@ -23,6 +23,12 @@ def match(tgt, delimiter=DEFAULT_TARGET_DELIM, opts=None): 'statement from master') return False + if 'pillar' in opts: + pillar = opts['pillar'] + elif 'ext_pillar' in opts: + log.info('No pillar found, fallback to ext_pillar') + pillar = opts['ext_pillar'] + return salt.utils.data.subdict_match( - opts['pillar'], tgt, delimiter=delimiter, regex_match=True + pillar, tgt, delimiter=delimiter, regex_match=True )