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

Acme state fixup master #55589

Merged
merged 15 commits into from
Dec 16, 2019
Merged

Conversation

github-abcde
Copy link
Contributor

What does this PR do?
(This is #53366 rebased on master, with #52455 included because that had already been merged into develop, but not yet into master)

Edit: Expanded on the changes in this PR. Clarified the changes to behaviour in test-mode. I earlier stated that test-mode is blatantly ignored, which was incorrect.

It fixes the state acme by implementing correct handling of opts['test'] and also properly detecting if a change is needed or not. It also fixes the returned changes (i.e. no changes returned if no changes were made, and only the changed items returned when there were changes.). Also now returns expected changes in test-mode.
Fixed handling of the window-parameter in salt.modules.acme.needs_renewal and thereby removing the broad Exception catching in acme.cert.
Moved check if certificate file actually exists into salt.modules.acme.info, removing
Pylint now scores both the module and the state, as well as the unittest files with a 10 :)

What issues does this PR fix or reference?
None that I'm aware of.

Previous Behavior
acme.cert always starts salt.modules.acme.cert regardless of whether a certificate renewal is needed.
No expected changes are reported in testmode, even when this is the case.
acme.cert always returns changes, even when no changes have been made (i.e. when a certificate was not due for renewal and no renewal had been forced).

New Behavior
acme.cert does not start salt.modules.acme.cert when the certificate specified does not need renewal and no renewal has been forced. It also now properly returns actual changes instead of always dumping the entire certificate information for both the certificate prior to the call to salt.modules.acme.cert and after.
Running acme.cert with opts['test'] == True returns changes when a certificate would have been fetched or renewed.

Tests written?
Yes

Commits signed with GPG?
Yes

github-abcde and others added 11 commits December 9, 2019 16:02
…w" parameter in "needs_renewal". Pylint-inspired layout fixes.
…ction if nothing/fetch/renew is needed to be done.
…509.read_certificate as alternative method of getting certificate information if tls.cert_info is not available.
…o using x509.read_certificates. Fixed incorrect data placement in textwrap.dedent. Updated test for acme.info to expect dict when using openssl cli.
@github-abcde github-abcde requested a review from a team as a code owner December 10, 2019 15:31
@ghost ghost requested a review from Akm0d December 10, 2019 15:32
@dwoz dwoz merged commit 21ed973 into saltstack:master Dec 16, 2019
@github-abcde github-abcde deleted the acme_state_fixup-master branch December 17, 2019 08:36
@github-abcde github-abcde mentioned this pull request Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants