diff --git a/nautobot_design_builder/design.py b/nautobot_design_builder/design.py index 660a003b..47239143 100644 --- a/nautobot_design_builder/design.py +++ b/nautobot_design_builder/design.py @@ -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 diff --git a/nautobot_design_builder/design_job.py b/nautobot_design_builder/design_job.py index 5e931003..61e88d14 100644 --- a/nautobot_design_builder/design_job.py +++ b/nautobot_design_builder/design_job.py @@ -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