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
Refactor publish func in master/masterapi to use check_authentication #43703
Refactor publish func in master/masterapi to use check_authentication #43703
Conversation
@rallytime, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DmitryKuzmenko, @terminalmage and @thatch45 to be potential reviewers. |
Ah, this isn't quite right. I need to look at this a little bit more. |
f298d54
to
1b33b03
Compare
Ok, this should be ready to review now, pending tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
In a previous PR, the runner and wheel functions in master.py and masterapi.py were refactored to reduce common code via the salt.auth.check_authentication method. The publish function also can utilize the check_authentication function in master.py and masterapi.py. Consolidation of this code will help us be able to differentiate between authorization and authentication errors in the future.
f78e8b7
to
74acaad
Compare
re-run py3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach!
Test failures are not related. |
re-run py3 |
See salt/scripts.py:
This is the normal flow (salt.minion effectively imported at line 92):
This is the wrong flow (salt.minion effectively imported at line 90):
Delayed import of |
@keesbos Thanks for adding that information. I think you're on the right track. I will dig into this more right now and submit a fix. |
Fixes saltstack#44435 PR saltstack#43703 inadvertently moved a "late import" statement up to the top of the auth file, which caused the problem reported in the PR itself and issue saltstack#44435. Moving the salt.utils.master import lower down in the file fixes the issue.
What does this PR do?
Refactors the
publish
function inmaster.py
andmasterapi.py
to usesalt.auth.check_authentication
and reworks the publish function in each file to be more concise.In a previous PR, the
runner
andwheel
functions inmaster.py
andmasterapi.py
were refactored to reduce common code via thesalt.auth.check_authentication
method.The
publish
function also can utilize thecheck_authentication
function inmaster.py
andmasterapi.py
.Consolidation of this code will help us be able to differentiate between
authorization
andauthentication
errors in the future.What issues does this PR fix or reference?
Builds on the work done in PR #43203.
This is necessary to fix (eventually) #6420, #34750, and #35160.
Tests written?
Yes
Please review Salt's Contributing Guide for best practices.