Skip to content

Commit

Permalink
Merge pull request #183 from napalm-automation/ansible-diff
Browse files Browse the repository at this point in the history
Add support for --diff argument
  • Loading branch information
ktbyers authored Aug 27, 2020
2 parents 845723a + 152fdda commit 61bd381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
develop
=======
- Provide diff in napalm_install_config in ``result.diff`` instead
of ``result.msg``.

1.1.0
=====
- Fix issue with -u <username> not working.
- Update tests to use newer Python and to use Ansible 2.8.x or 2.9.x.
Expand Down
10 changes: 6 additions & 4 deletions napalm_ansible/modules/napalm_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ def return_values(obj):
returned: always
type: bool
sample: True
msg:
diff:
description: diff of the change
returned: always
type: string
sample: "[edit system]\n- host-name lab-testing;\n+ host-name lab;"
type: dict
sample: {
'prepared': "[edit system]\n- host-name lab-testing;\n+ host-name lab;",
}
"""

napalm_found = False
Expand Down Expand Up @@ -331,7 +333,7 @@ def main():
except Exception as e:
module.fail_json(msg="cannot close device connection: " + str(e))

module.exit_json(changed=changed, msg=diff)
module.exit_json(changed=changed, diff={"prepared": diff}, msg=diff)


if __name__ == "__main__":
Expand Down

0 comments on commit 61bd381

Please sign in to comment.