def test_split_patterns(self): for p in self.patterns: r = self.patterns[p] self.assertEqual(r, split_host_pattern(p)) for p, r in self.pattern_lists: self.assertEqual(r, split_host_pattern(p))
def run(self, terms, variables=None, **kwargs): host_list = [] for term in terms: patterns = order_patterns(split_host_pattern(term)) for p in patterns: that = self.get_hosts(variables, p) if p.startswith("!"): host_list = [h for h in host_list if h not in that] elif p.startswith("&"): host_list = [h for h in host_list if h in that] else: host_list.extend(that) # return unique list return list(set(host_list))
def run(self, terms, variables=None, **kwargs): host_list = [] for term in terms: patterns = order_patterns(split_host_pattern(term)) for p in patterns: that = self.get_hosts(variables, p) if p.startswith("!"): host_list = [h for h in host_list if h not in that] elif p.startswith("&"): host_list = [h for h in host_list if h in that] else: host_list.extend(that) # return unique list return list(set(host_list))