MCPcopy
hub / github.com/saltstack/salt / glob_match

Method glob_match

salt/key.py:511–534  ·  view source on GitHub ↗

Accept a glob which to match the of a key and return the key's location

(self, match, full=False)

Source from the content-addressed store, hash-verified

509 return True
510
511 def glob_match(self, match, full=False):
512 """
513 Accept a glob which to match the of a key and return the key's location
514 """
515 if full:
516 matches = self.all_keys()
517 else:
518 matches = self.list_keys()
519 ret = {}
520 if "," in match and isinstance(match, str):
521 match = match.split(",")
522 if not isinstance(match, list):
523 match = [match]
524 for status, keys in matches.items():
525 if match == ["*"] and keys:
526 ret[status] = keys
527 continue
528 for key in salt.utils.data.sorted_ignorecase(keys):
529 for match_item in match:
530 if fnmatch.fnmatch(key, match_item):
531 if status not in ret:
532 ret[status] = []
533 ret[status].append(key)
534 return ret
535
536 def list_match(self, match):
537 """

Callers 6

key_strMethod · 0.95
change_stateMethod · 0.95
delete_keyMethod · 0.95
fingerMethod · 0.95
_check_glob_minionsMethod · 0.80
glob_matchFunction · 0.80

Calls 4

all_keysMethod · 0.95
list_keysMethod · 0.95
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected