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

openssl_pkcs12: Add a check for parsed pkcs12 files #145

Merged

Conversation

Normo
Copy link
Contributor

@Normo Normo commented Nov 20, 2020

SUMMARY

With this pull request the parse action for the openssl_pkcs12 module is now considered separately in the check() function.

Fixes #143

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • openssl_pkcs12
ADDITIONAL INFORMATION

Without this change, the parse action would always result in changed state when running in check mode.

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
Copy link
Contributor

@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.

This is a bit messy, but the whole module is somewhat messy and needs a refactoring. So LGTM :)

Can you add a changelog fragment and add basic tests for this situation?

For tests, it probably makes sense to duplicate this: https://github.com/ansible-collections/community.crypto/blob/main/tests/integration/targets/openssl_pkcs12/tasks/impl.yml#L85-L90 register the result, and make sure in https://github.com/ansible-collections/community.crypto/blob/main/tests/integration/targets/openssl_pkcs12/tests/validate.yml that the task didn't change. Of course more extensive tests are also nice, but such a basic one would already be a big improvement!

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
@felixfontein
Copy link
Contributor

And are you sure this is only a problem in check mode, and not also for regular mode? Glancing over the code, I guess both had this issue before (and your fix fixes both).

Norman Ziegner added 3 commits November 23, 2020 07:56
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
@Normo
Copy link
Contributor Author

Normo commented Nov 23, 2020

And are you sure this is only a problem in check mode, and not also for regular mode? Glancing over the code, I guess both had this issue before (and your fix fixes both).

Not quite! But 64890dd should now ensure that the correct state is also reported in normal mode (instead of always ok). I have adapted the changelog fragment for this purpose and provided a basic test.

@felixfontein Could you please review again?

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
Copy link
Contributor

@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.

LGTM

@felixfontein felixfontein merged commit 86b3973 into ansible-collections:main Nov 23, 2020
@felixfontein
Copy link
Contributor

@Normo thanks a lot for fixing this!

@Normo Normo deleted the fix-pkcs12-parse-check-mode branch November 23, 2020 10:01
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

Successfully merging this pull request may close these issues.

openssl_pkcs12 parse action: always changed in check mode
2 participants