Skip to content

Commit

Permalink
Fixed error message for invalid action (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
abates authored Mar 29, 2024
1 parent bbd6f9d commit 6f6e56d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nautobot_design_builder/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def action(self, action: str):
specified action is different than what was previously set.
"""
if action not in self.ACTION_CHOICES:
raise errors.DesignImplementationError(f"Unknown action {self._action}", self.model_instance.model_class)
raise errors.DesignImplementationError(f"Unknown action {action}", self.model_instance.model_class)

if self._action is None or self._action == action:
self._action = action
Expand Down
6 changes: 5 additions & 1 deletion nautobot_design_builder/design_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ def run(self, **kwargs): # pylint: disable=arguments-differ
return self._run_in_transaction(**kwargs)
finally:
if self.rendered:
self.save_design_file(self.rendered_design, self.rendered)
rendered_design = path.basename(self.rendered_design)
rendered_design, _ = path.splitext(rendered_design)
if not rendered_design.endswith(".yaml") and not rendered_design.endswith(".yml"):
rendered_design = f"{rendered_design}.yaml"
self.save_design_file(rendered_design, self.rendered)
for design_file, design in self.designs.items():
output_file = path.basename(design_file)
# this should remove the .j2
Expand Down

0 comments on commit 6f6e56d

Please sign in to comment.