CONFIG_ATTRIBUTES=('aggregator_report_period','aggregator_database_name','aggregator_database_url')# all of the configuration attributes - to be used as dictionary keys
...
...
@@ -37,6 +37,15 @@ MALFORMED_FLAG = 'malformed' # Attribute for storing the flag, which shows whet
COMMENT_ATTRIBUTE='comment'
COMMENT_VALUE='Aggregator is running in a malformed state - it uses an old version of the configuration. Please, restart it so that the updated configuration is used.'
URL_REGEX=compile(
r'^https?://'# http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'# domain, e.g. example.domain.com
r'localhost|'# or localhost...
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'# or IP address (IPv4 format)
r'(?::\d{2,5})?'# optional port number
r'(?:[/?#][^\s]*)?$',# URL path or query parameters
asserttype(configuration['aggregator_report_period'])==int,"Report period must be an integer, received {0} instead.".format(configuration.get('aggregator_report_period'))
asserttype(configuration.get('aggregator_report_period'))==int,"Report period must be an integer, received {0} instead.".format(configuration.get('aggregator_report_period'))
assertconfiguration.get('aggregator_report_period')>0,"Report period must be a positive integer, received {0} instead.".format(configuration.get('aggregator_report_period'))
assertconfiguration['aggregator_report_period']>0,"Report period must be a positive integer, received {0} instead.".format(configuration.get('aggregator_report_period'))
assertURL_REGEX.match(configuration.get('aggregator_database_url'))isnotNone,"The aggregator must have a valid database URL in its configuration, received {0} instead.".format(configuration.get('aggregator_report_period'))