Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix find_template_values when vipValue not present (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzeG authored Mar 14, 2024
1 parent faba69a commit c5cf60d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions catalystwan/utils/feature_template/find_template_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ def find_template_values(
return templated_values

value = template_definition[target_key]
template_value = template_definition[target_key_for_template_value]
template_value = template_definition.get(target_key_for_template_value)

field_key = path[-1]
# TODO: Handle nested DeviceVariable
if value == "variableName":
if device_specific_variables is not None:
device_specific_variables[field_key] = DeviceVariable(name=template_definition["vipVariableName"])
elif template_definition["vipType"] == "variable":
return template_definition
if template_value is None:
return template_definition

if template_definition["vipType"] == "variable":
if device_specific_variables is not None and template_value:
device_specific_variables[field_key] = DeviceVariable(name=template_value)
elif template_definition["vipObjectType"] == "list":
Expand Down

0 comments on commit c5cf60d

Please sign in to comment.