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

consul_kv: add diff output in add_value method (state=present) when the value changed #28278

Closed
lhoss opened this issue Aug 16, 2017 · 4 comments
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bot_closed clustering Clustering category collection:community.general collection Related to Ansible Collections work feature This issue/PR relates to a feature request. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community.

Comments

@lhoss
Copy link

lhoss commented Aug 16, 2017

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

lib/ansible/modules/clustering/consul_kv.py

ANSIBLE VERSION

ansible 2.3.0.0
ansible 2.4.0.0

SUMMARY

Currently the consul_kv module does not provide any extra diff output (when running ansible with the so useful --diff option).
Diff output (we could make it optional, by an extra optional parameter like 'diffView') should be easy to add using the module.exit_json diff return attribute containing both the old and new value for the updated key, in following fashion:

    index, existing = consul_api.kv.get(key)
    ...
    # to support diff-mode, just need following block:
    if existing and existing['Value']:
        ansible_diff = {'before': existing['Value'],  'after': value}
    else:
        ansible_diff = None

    module.exit_json(changed=changed,
                     index=index,
                     key=key,
                     data=stored,
                     diff= ansible_diff
)

Note: Untested code
Update: I've already tested the new --diff successfully in a duplicated consul_kv.py file. TODO make a PR etc

@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2017

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 feature_idea module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Aug 16, 2017
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Aug 17, 2017
@Rudd-O
Copy link

Rudd-O commented Aug 21, 2017

Seconded!

@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_idea labels Mar 2, 2018
@ansibot
Copy link
Contributor

ansibot commented Mar 26, 2018

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels Sep 19, 2018
@ansibot ansibot added needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 5, 2018
@ansibot ansibot removed the needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) label Nov 10, 2018
@ansibot ansibot added the clustering Clustering category label Mar 5, 2019
@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 28, 2019
@ansibot ansibot added collection Related to Ansible Collections work collection:community.general needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 17, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this as completed Aug 17, 2020
@ansible ansible locked and limited conversation to collaborators Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bot_closed clustering Clustering category collection:community.general collection Related to Ansible Collections work feature This issue/PR relates to a feature request. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

No branches or pull requests

4 participants