From 6798a54a61f6e1215e09e31bc66c6633363a8c56 Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Fri, 12 Aug 2016 13:13:59 +0100 Subject: [PATCH] ConfigParser: Added ID validation - IDs cannot contain a `-` because its used to separate section IDs from workload IDs - `global` is a reserved ID for the "global" section. --- wlauto/core/configuration/parsers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wlauto/core/configuration/parsers.py b/wlauto/core/configuration/parsers.py index 7a4ba5cd..ba91701f 100644 --- a/wlauto/core/configuration/parsers.py +++ b/wlauto/core/configuration/parsers.py @@ -210,6 +210,10 @@ class AgendaParser(object): continue if entry_id in seen_section_ids: raise ConfigError('Duplicate section ID "{}".'.format(entry_id)) + # "-" is reserved for joining section and workload IDs + if "-" in entry_id: + msg = 'Invalid ID "{}"; IDs cannot contain a "-"' + raise ConfigError(msg.format(entry_id)) seen_section_ids.add(entry_id) seen_workload_ids = set() @@ -219,6 +223,12 @@ class AgendaParser(object): continue if entry_id in seen_workload_ids: raise ConfigError('Duplicate workload ID "{}".'.format(entry_id)) + # "-" is reserved for joining section and workload IDs + if "-" in entry_id: + msg = 'Invalid ID "{}"; IDs cannot contain a "-"' + raise ConfigError(msg.format(entry_id)) + if entry_id == "global": + raise ConfigError(('The ID "global" is reserved')) seen_workload_ids.add(entry_id) # PHASE 4: Assigning IDs and validating entries