diff --git a/initializers/device_types.yml b/initializers/device_types.yml index ffb45fe..b1ee130 100644 --- a/initializers/device_types.yml +++ b/initializers/device_types.yml @@ -31,8 +31,7 @@ # - name_template: ttyS[1-48] # type: rj-45 # power_ports: -# - name: psu0 # both non-template and template field specified; non-template field takes precedence -# name_template: psu[0,1] +# - name_template: psu[0,1] # type: iec-60320-c14 # maximum_draw: 35 # allocated_draw: 35 @@ -46,7 +45,9 @@ # type: 8p8c # positions_template: "[3,2]" # device_bays: -# - name_template: bay[0-9] +# - name: bay0 # both non-template and template field specified; non-template field takes precedence +# name_template: bay[0-9] +# label: test0 # label_template: test[0-5,9,6-8] # description: Test description # power_outlets: diff --git a/startup_scripts/190_device_types.py b/startup_scripts/190_device_types.py index d154805..d20c9e6 100644 --- a/startup_scripts/190_device_types.py +++ b/startup_scripts/190_device_types.py @@ -36,14 +36,13 @@ def expand_templates(params: List[dict], device_type: DeviceType) -> List[dict]: if field in param: has_plain_fields = True - expanded.append(param) elif template_value: expanded_fields[field] = list(expand_alphanumeric_pattern(template_value)) if expanded_fields and has_plain_fields: raise ValueError(f"Mix of plain and template keys provided for {templateable_fields}") - - if not expanded_fields: + elif not expanded_fields: + expanded.append(param) continue elements = list(expanded_fields.values())