"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/collector/__init__.py" between
cloudkitty-16.0.0.tar.gz and cloudkitty-17.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Zed" series (latest release).

__init__.py  (cloudkitty-16.0.0):__init__.py  (cloudkitty-17.0.0)
skipping to change at line 93 skipping to change at line 93
All(str, Length(min=1)) All(str, Length(min=1))
], ],
# Available in HashMap # Available in HashMap
Required('metadata', default=list): [ Required('metadata', default=list): [
All(str, Length(min=1)) All(str, Length(min=1))
], ],
# Mutate collected value. May be any of: # Mutate collected value. May be any of:
# (NONE, NUMBOOL, NOTNUMBOOL, FLOOR, CEIL). # (NONE, NUMBOOL, NOTNUMBOOL, FLOOR, CEIL).
# Defaults to NONE # Defaults to NONE
Required('mutate', default='NONE'): Required('mutate', default='NONE'):
In(['NONE', 'NUMBOOL', 'NOTNUMBOOL', 'FLOOR', 'CEIL']), In(['NONE', 'NUMBOOL', 'NOTNUMBOOL', 'FLOOR', 'CEIL', 'MAP']),
# Map dict used if mutate == 'MAP'
Optional('mutate_map'): dict,
# Collector-specific args. Should be overriden by schema provided for # Collector-specific args. Should be overriden by schema provided for
# the given collector # the given collector
Optional('extra_args'): dict, Optional('extra_args'): dict,
} }
def get_collector(): def get_collector():
metrics_conf = ck_utils.load_conf(CONF.collect.metrics_conf) metrics_conf = ck_utils.load_conf(CONF.collect.metrics_conf)
collector_args = { collector_args = {
'period': CONF.collect.period, 'period': CONF.collect.period,
'conf': metrics_conf, 'conf': metrics_conf,
skipping to change at line 262 skipping to change at line 264
duplicates = groupby.intersection(metadata) duplicates = groupby.intersection(metadata)
if duplicates: if duplicates:
raise InvalidConfiguration( raise InvalidConfiguration(
'Metric {} has duplicates in groupby and metadata: {}'.format( 'Metric {} has duplicates in groupby and metadata: {}'.format(
metric_name, metric)) metric_name, metric))
metric['groupby'] = list(groupby) metric['groupby'] = list(groupby)
metric['metadata'] = list(metadata) metric['metadata'] = list(metadata)
return metric return metric
def validate_map_mutator(metric_name, metric):
"""Validates MAP mutator"""
mutate = metric.get('mutate')
mutate_map = metric.get('mutate_map')
if mutate == 'MAP' and mutate_map is None:
raise InvalidConfiguration(
'Metric {} uses MAP mutator but mutate_map is missing: {}'.format(
metric_name, metric))
if mutate != 'MAP' and mutate_map is not None:
raise InvalidConfiguration(
'Metric {} not using MAP mutator but mutate_map is present: '
'{}'.format(metric_name, metric))
def validate_conf(conf): def validate_conf(conf):
"""Validates the provided configuration.""" """Validates the provided configuration."""
collector = get_collector_without_invoke() collector = get_collector_without_invoke()
output = collector.check_configuration(conf) output = collector.check_configuration(conf)
for metric_name, metric in output.items(): for metric_name, metric in output.items():
if 'alt_name' not in metric.keys(): if 'alt_name' not in metric.keys():
metric['alt_name'] = metric_name metric['alt_name'] = metric_name
check_duplicates(metric_name, metric) check_duplicates(metric_name, metric)
validate_map_mutator(metric_name, metric)
return output return output
 End of changes. 3 change blocks. 
1 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)