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

Fix x509 CRL creation (fixes #54867) #58272

Merged
merged 2 commits into from
Aug 24, 2020
Merged

Conversation

alxwr
Copy link
Contributor

@alxwr alxwr commented Aug 24, 2020

What does this PR do?

Fixes this error:

     Comment: An exception occurred in this state: Traceback (most recent call last):                                 
                File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 2154, in call                       
                  *cdata["args"], **cdata["kwargs"]                                                                   
                File "/usr/local/lib/python3.7/site-packages/salt/loader.py", line 2085, in wrapper                   
                  return f(*args, **kwargs)                                                                           
                File "/usr/local/lib/python3.7/site-packages/salt/states/x509.py", line 828, in crl_managed           
                  current = __salt__["x509.read_crl"](crl=name)                                                       
                File "/usr/local/lib/python3.7/site-packages/salt/modules/x509.py", line 678, in read_crl             
                  crltempfile.write(salt.utils.stringutils.to_str(text))                                              
                File "/usr/local/lib/python3.7/tempfile.py", line 481, in func_wrapper                                
                  return func(*args, **kwargs)                                                                        
              TypeError: a bytes-like object is required, not 'str'

What issues does this PR fix or reference?

Fixes: #54867

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Note: contrary to the testing guide, this is the proper command to run the tests:

nox -e 'pytest-zeromq-m2crypto-3(coverage=False)' -- --run-slow tests/unit/modules/test_x509.py tests/integration/states/test_x509.py

[…]

collected 30 items                                                                                                   

tests/unit/modules/test_x509.py ......................................................................................
..................................................+++++
....................................................+++++
.....
tests/integration/states/test_x509.py ..................

=========================================== 30 passed in 126.97s (0:02:06) ===========================================
nox > Session pytest-parametrized-3(crypto='m2crypto', transport='zeromq', coverage=False) was successful.
nox > Ran multiple sessions:
nox > * pytest-zeromq-m2crypto-3(coverage=False): success
nox > * pytest-parametrized-3(crypto='m2crypto', transport='zeromq', coverage=False): success

Commits signed with GPG?

No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@alxwr alxwr requested a review from a team as a code owner August 24, 2020 01:23
@krionbsd
Copy link
Contributor

@alxwr thank you for contribution! Could you please run pre-commit run $filename to pass pre-commit CI, thanks.

@alxwr
Copy link
Contributor Author

alxwr commented Aug 24, 2020

@alxwr thank you for contribution! Could you please run pre-commit run $filename to pass pre-commit CI, thanks.

@krionbsd Thanks for this hint!
(Note for other readers: I had to pip3 install pre-commit first.)

Result: success, including this beauty:

Your code has been rated at 9.81/10

@krionbsd
Copy link
Contributor

@alxwr thank you for contribution! Could you please run pre-commit run $filename to pass pre-commit CI, thanks.

@krionbsd Thanks for this hint!
(Note for other readers: I had to pip3 install pre-commit first.)

Result: success, including this beauty:

Your code has been rated at 9.81/10

Awesome! Thank you! It will be merged soon.

@dwoz dwoz merged commit 0a1be82 into saltstack:master Aug 24, 2020
@alxwr alxwr deleted the fix-x509-CRL-write branch August 25, 2020 20:51
@sagetherage sagetherage added the Magnesium Mg release after Na prior to Al label Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Magnesium Mg release after Na prior to Al
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x509.crl_managed not working - error on digest
4 participants