mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-06-27 02:33:26 +01:00
Configuration: Added global_aliase
Previously `aliases` was conflated with global_aliases. This commit fixes this. `global_alias`'s are a name that can be used in top level configuration and set the values of one or more plugin parameters that use the same global_alias. `aliases` is a list of alternative names for a configuration point. Currently this is only used for instrumentation/instruments and workload_name/name but in the future it will likely be used when parameters have to be renamed to be more meaningful but still maintain backward compatibility.
This commit is contained in:
wlauto/core/configuration
@ -168,7 +168,8 @@ class ConfigurationPoint(object):
|
||||
description=None,
|
||||
constraint=None,
|
||||
merge=False,
|
||||
aliases=None):
|
||||
aliases=None,
|
||||
global_alias=None):
|
||||
"""
|
||||
Create a new Parameter object.
|
||||
|
||||
@ -216,6 +217,9 @@ class ConfigurationPoint(object):
|
||||
``merge_config_values`` documentation for details.
|
||||
:param aliases: Alternative names for the same configuration point.
|
||||
These are largely for backwards compatibility.
|
||||
:param global_alias: An alias for this parameter that can be specified at
|
||||
the global level. A global_alias can map onto many
|
||||
ConfigurationPoints.
|
||||
"""
|
||||
self.name = identifier(name)
|
||||
if kind in KIND_MAP:
|
||||
@ -235,6 +239,7 @@ class ConfigurationPoint(object):
|
||||
self.constraint = constraint
|
||||
self.merge = merge
|
||||
self.aliases = aliases or []
|
||||
self.global_alias = global_alias
|
||||
|
||||
if self.default is not None:
|
||||
try:
|
||||
@ -243,9 +248,9 @@ class ConfigurationPoint(object):
|
||||
raise ValueError('Default value "{}" is not valid'.format(self.default))
|
||||
|
||||
def match(self, name):
|
||||
if name == self.name:
|
||||
if name == self.name or name in self.aliases:
|
||||
return True
|
||||
elif name in self.aliases:
|
||||
elif name == self.global_alias:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
Reference in New Issue
Block a user