Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in diff on resource_module for result #599

Open
jakegroves opened this issue Nov 9, 2023 · 0 comments
Open

Add in diff on resource_module for result #599

jakegroves opened this issue Nov 9, 2023 · 0 comments
Assignees

Comments

@jakegroves
Copy link

SUMMARY

https://github.com/ansible-collections/ansible.netcommon/blob/main/plugins/module_utils/network/common/rm_base/resource_module.py#L67 currently returns alot of information, however does not return a diff dictionary

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

resource_module

ADDITIONAL INFORMATION

It could be beneficial to have a diff dictionary in the result property
Otherwise every module consuming (eos,ios etc) has to create one where necessary
Can possibly do something along the lines of:

import yaml

...
            if self.commands:
                current_conf = self.get_facts(self._empty_fact_val)
                result["after"] = current_conf
                result["diff"] = dict(
                    before=yaml.safe_dump(self.before),
                    after=yaml.safe_dump(current_conf)
                )

This is based on assumptions of how resourcemodule works
Or are we expecting to implement it ourselves on local module side?

@ashwini-mhatre ashwini-mhatre self-assigned this Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants