nautobot/nautobot-app-golden-config

Return Nornir Config Diff in Deploy Config Plans Job Result

housepbass opened this issue · 0 comments

Environment

  • Python version: 3.9
  • Nautobot version: 1.6.2
  • nautobot-golden-config version: 1.6.0

Proposed Functionality

In the Deploy Config Plans Job Result, after a successful configuration deployment, the logger currently returns:

result: None, changed: True

I propose that the result includes the configuration diff provided by the nornir result.

Use Case

This feature helps instill confidence to the user about their deployed Config Set as they will see an additional configuration diff from the device's perspective.

Essentially, when Config Set == nornir.result.diff, user confidence will be high.

An example method:

 def task_instance_completed(
     self, task: Task, host: Host, result: MultiResult
 ) -> None:
     """Task instance completed logger."""
     # If device config was changed, log the diff to the job results
     if result.changed:
         self.job.log_success(
             task.host.data["obj"], f"DIFF:\n```\n{result[1].diff}\n```"
         )