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 --diff support for ldap_attrs module #8073

Merged

Conversation

StopMotionCuber
Copy link
Contributor

SUMMARY

This adds support for the --diff mode for the ldap_attrs module. For the other ldap modules this does not really make sense, as ldap_search is read-only and for ldap_entry there is only a change if the entry is not there at all (so the state is quite clear).
We would like to use this kind of feature for internal use of the module.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ldap_attrs

ADDITIONAL INFORMATION

Right now, the module does not search for all available attributes at the same time. The --diff mode therefore has difficulties if we are only adding/deleting single values of a multi value attribute to detect what was there before and what would be the final state.
With --exact, we're replacing everything, therefore this issue is not present there.
I'm not sure about the policy on this repo, whether a potentially misleading diff is worse than none. Could also change that to not use "before" and "after", but going for "prepared" and a message like "<key>: Added value(s) [<value1>, <value2>]" for the presentorabsentstate. We are only using theexact` state, so partial diff support only for that state would be fine to us.

Furthermore, attributes are not shown in the --diff if they are on the server, but not used within the module (probably not an issue).

Yeah well, as you can see from the longish message here I also want to get the discussion going. I'll add the fragment as soon as the discussions here are cleared up and the path for the PR is more clear.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Mar 8, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch labels Mar 9, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

plugins/modules/ldap_attrs.py Show resolved Hide resolved
@StopMotionCuber
Copy link
Contributor Author

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

Have added the changelog fragment and added version_added for diff mode.
Thank you for your quick response and review of the MR

Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise it looks good, now just a couple of minor adjustments for the documentation.

changelogs/fragments/8073-ldap-attrs-diff.yml Outdated Show resolved Hide resolved
plugins/modules/ldap_attrs.py Show resolved Hide resolved
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit for the changelog fragment :)

changelogs/fragments/8073-ldap-attrs-diff.yml Outdated Show resolved Hide resolved
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein merged commit 09cded0 into ansible-collections:main Mar 14, 2024
124 checks passed
Copy link

patchback bot commented Mar 14, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/09cded05e76dae2549c60711222c733921dffcef/pr-8073

Backported as #8099

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Mar 14, 2024
patchback bot pushed a commit that referenced this pull request Mar 14, 2024
* Add --diff support for ldap_attrs module

* Change diff_mode support in docstring to full

* Use _attrs suffix for old and new

* Add version added to ldap_attrs diff mode

* Add fragment for ldap_attrs diff mode

* Update fragment to include link to PR and lowercase start

* Update changelogs/fragments/8073-ldap-attrs-diff.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 09cded0)
@felixfontein
Copy link
Collaborator

@StopMotionCuber thanks for your contribution!
@russoz thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Mar 14, 2024
…trs module (#8099)

Add --diff support for ldap_attrs module (#8073)

* Add --diff support for ldap_attrs module

* Change diff_mode support in docstring to full

* Use _attrs suffix for old and new

* Add version added to ldap_attrs diff mode

* Add fragment for ldap_attrs diff mode

* Update fragment to include link to PR and lowercase start

* Update changelogs/fragments/8073-ldap-attrs-diff.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 09cded0)

Co-authored-by: StopMotionCuber <ruben.simons@web.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants