+ elif isinstance(builds, list):
+ for idx, item in enumerate(builds):
+ try:
+ builds[idx] = int(item)
+ except ValueError:
+ # defined as a range <build_type>
+ builds[idx] = self._get_build_number(job, item)
+
+ # Data sets: add sub-sets to sets (only one level):
+ for set_name, data_set in self.configuration["data-sets"].items():
+ if isinstance(data_set, list):
+ new_set = dict()
+ for item in data_set:
+ try:
+ for key, val in self.configuration["data-sets"][item].\
+ items():
+ new_set[key] = val
+ except KeyError:
+ raise PresentationError(
+ "Data set {0} is not defined in "
+ "the configuration section.".format(item))
+ self.configuration["data-sets"][set_name] = new_set
+
+ # Mapping table:
+ mapping = None
+ mapping_file_name = self._specification["configuration"].\
+ get("mapping-file", None)
+ if mapping_file_name:
+ logging.debug("Mapping file: '{0}'".format(mapping_file_name))
+ try:
+ with open(mapping_file_name, 'r') as mfile:
+ mapping = load(mfile)
+ logging.debug("Loaded mapping table:\n{0}".format(mapping))
+ except (YAMLError, IOError) as err:
+ raise PresentationError(
+ msg="An error occurred while parsing the mapping file "
+ "'{0}'.".format(mapping_file_name),
+ details=repr(err))
+ # Make sure everything is lowercase
+ if mapping:
+ self._specification["configuration"]["mapping"] = \
+ {key.lower(): val.lower() for key, val in mapping.iteritems()}
+ else:
+ self._specification["configuration"]["mapping"] = dict()
+
+ # Ignore list:
+ ignore = None
+ ignore_list_name = self._specification["configuration"].\
+ get("ignore-list", None)
+ if ignore_list_name:
+ logging.debug("Ignore list file: '{0}'".format(ignore_list_name))
+ try:
+ with open(ignore_list_name, 'r') as ifile:
+ ignore = load(ifile)
+ logging.debug("Loaded ignore list:\n{0}".format(ignore))
+ except (YAMLError, IOError) as err:
+ raise PresentationError(
+ msg="An error occurred while parsing the ignore list file "
+ "'{0}'.".format(ignore_list_name),
+ details=repr(err))
+ # Make sure everything is lowercase
+ if ignore:
+ self._specification["configuration"]["ignore"] = \
+ [item.lower() for item in ignore]
+ else:
+ self._specification["configuration"]["ignore"] = list()