Accept a glob which to match the of a key and return the key's location
(self, match, full=False)
| 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 | """ |
no test coverage detected