Skip to content

Commit

Permalink
fix template mapping for task attrs that are falsy
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 23, 2023
1 parent fb2cccb commit 7291168
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/engine/src/helpers/TemplateMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ def map(self, obj: Union[Pipeline, Task], uses: Uses) -> Union[Pipeline, Task]:
if attr == "type":
dict_obj["type"] = template.get(attr)
continue

if getattr(obj, attr, None) == None:

# Add the template's value for this attribute if the original object's
# value is not None, or if the object's og value is falsy and the templates value is not
if (
getattr(obj, attr, None) in [[], {}, "", None]
and template[attr] not in [[], {}, "", None]
):
dict_obj[attr] = template[attr]

# Create a new object out of the modified dict representation of the original object
Expand Down

0 comments on commit 7291168

Please sign in to comment.