Ejemplo n.º 1
0
    def is_supported(dataset, data_name):
        # Support wildcard like storage.* and !disk.*
        # Start with negation, we consider that the order is deny, allow
        if any(utils.match(data_name, datapoint[1:])
               for datapoint in dataset if datapoint[0] == '!'):
            return False

        if any(utils.match(data_name, datapoint)
               for datapoint in dataset if datapoint[0] != '!'):
            return True

        # if we only have negation, we suppose the default is allow
        return all(datapoint.startswith('!') for datapoint in dataset)
Ejemplo n.º 2
0
    def is_supported(dataset, data_name):
        # Support wildcard like storage.* and !disk.*
        # Start with negation, we consider that the order is deny, allow
        if any(utils.match(data_name, datapoint[1:])
               for datapoint in dataset if datapoint[0] == '!'):
            return False

        if any(utils.match(data_name, datapoint)
               for datapoint in dataset if datapoint[0] != '!'):
            return True

        # if we only have negation, we suppose the default is allow
        return all(datapoint.startswith('!') for datapoint in dataset)
Ejemplo n.º 3
0
 def _match(pollster):
     """Find out if pollster name matches to one of the list."""
     return any(utils.match(pollster.name, pattern) for
                pattern in pollster_list)
Ejemplo n.º 4
0
 def get(self, metric_name):
     if self.cfg is not None:
         for metric, policy in self.cfg.items():
             # Support wild cards such as disk.*
             if utils.match(metric_name, metric):
                 return policy
Ejemplo n.º 5
0
 def match(self, metric_name):
     for t in self.cfg['metrics']:
         if utils.match(metric_name, t):
             return True
     return False
Ejemplo n.º 6
0
 def get(self, metric_name):
     if self.cfg is not None:
         for metric, policy in self.cfg.items():
             # Support wild cards such as disk.*
             if utils.match(metric_name, metric):
                 return policy
Ejemplo n.º 7
0
 def match(self, metric_name):
     for t in self.cfg['metrics']:
         if utils.match(metric_name, t):
             return True
     return False
Ejemplo n.º 8
0
 def _match(pollster):
     """Find out if pollster name matches to one of the list."""
     return any(
         utils.match(pollster.name, pattern)
         for pattern in pollster_list)
Ejemplo n.º 9
0
 def match_type(self, meter_name):
     for t in self._event_type:
         if utils.match(meter_name, t):
             return True
Ejemplo n.º 10
0
 def match_type(self, meter_name):
     for t in self._event_type:
         if utils.match(meter_name, t):
             return True
Ejemplo n.º 11
0
 def excluded_type(self, event_type):
     for t in self._excluded_types:
         if utils.match(event_type, t):
             return True
     return False
Ejemplo n.º 12
0
 def excluded_type(self, event_type):
     for t in self._excluded_types:
         if utils.match(event_type, t):
             return True
     return False