diff options
author | Tibor Frank <tifrank@cisco.com> | 2019-02-18 09:37:20 +0100 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2019-02-18 13:01:03 +0100 |
commit | 99607701fe5f09ee1c691257e18a54d4fd17eaf3 (patch) | |
tree | 068af5865958a596b36e96b195df1a4dcc0c6a91 /resources/tools/presentation/specification_parser.py | |
parent | 1aeacc2c1efb0ce39c2d0789ec04a694a0943ba7 (diff) |
CSIT-1433: Add data sets to all tables
- Improving and simplifying the process of adding new data.
Change-Id: I778af0274584b881de4e1f90f63cdc04d1b796bb
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/specification_parser.py')
-rw-r--r-- | resources/tools/presentation/specification_parser.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/resources/tools/presentation/specification_parser.py b/resources/tools/presentation/specification_parser.py index 97662899e3..f71c482ec3 100644 --- a/resources/tools/presentation/specification_parser.py +++ b/resources/tools/presentation/specification_parser.py @@ -420,6 +420,8 @@ class Specification(object): # Data sets: Replace ranges by lists for set_name, data_set in self.configuration["data-sets"].items(): + if not isinstance(data_set, dict): + continue for job, builds in data_set.items(): if builds: if isinstance(builds, dict): @@ -432,6 +434,21 @@ class Specification(object): builds = [x for x in range(builds["start"], build_nr+1)] self.configuration["data-sets"][set_name][job] = builds + # Data sets: add sub-sets to sets: + 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"].\ @@ -602,6 +619,27 @@ class Specification(object): self._specification["environment"]["paths"]) except KeyError: pass + + # add data sets + try: + for item in ("reference", "compare"): + if element.get(item, None): + data_set = element[item].get("data", None) + if isinstance(data_set, str): + element[item]["data"] = \ + self.configuration["data-sets"][data_set] + + if element.get("history", None): + for i in range(len(element["history"])): + data_set = element["history"][i].get("data", None) + if isinstance(data_set, str): + element["history"][i]["data"] = \ + self.configuration["data-sets"][data_set] + + except KeyError: + raise PresentationError("Wrong data set used in {0}.". + format(element.get("title", ""))) + self._specification["tables"].append(element) count += 1 |