mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 13:41:24 +00:00
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.
This commit is contained in:
parent
451d973a65
commit
6798a54a61
@ -210,6 +210,10 @@ class AgendaParser(object):
|
|||||||
continue
|
continue
|
||||||
if entry_id in seen_section_ids:
|
if entry_id in seen_section_ids:
|
||||||
raise ConfigError('Duplicate section ID "{}".'.format(entry_id))
|
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_section_ids.add(entry_id)
|
||||||
|
|
||||||
seen_workload_ids = set()
|
seen_workload_ids = set()
|
||||||
@ -219,6 +223,12 @@ class AgendaParser(object):
|
|||||||
continue
|
continue
|
||||||
if entry_id in seen_workload_ids:
|
if entry_id in seen_workload_ids:
|
||||||
raise ConfigError('Duplicate workload ID "{}".'.format(entry_id))
|
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)
|
seen_workload_ids.add(entry_id)
|
||||||
|
|
||||||
# PHASE 4: Assigning IDs and validating entries
|
# PHASE 4: Assigning IDs and validating entries
|
||||||
|
Loading…
x
Reference in New Issue
Block a user