Skip to content

Fix for module.run show result as True when module returned False as result #67924

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

Closed
wants to merge 3 commits into from

Conversation

SndR85
Copy link
Contributor

@SndR85 SndR85 commented Mar 26, 2025

What does this PR do?

What issues does this PR fix or reference?

Fixes #65842

Previous Behavior

If module.run was running a module which returned False in it's result, the module.run state would return it as successful with it's result set to True.

New Behavior

With this change the state will have result set to False if the module contains a result where the value not is equal to True.

Merge requirements satisfied?

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

Commits signed with GPG?

Yes

@SndR85 SndR85 requested a review from a team as a code owner March 26, 2025 13:37
@SndR85 SndR85 changed the title Fix/issue 65842 Fix for module.run result True when module returned False as result Mar 26, 2025
@SndR85 SndR85 changed the title Fix for module.run result True when module returned False as result Fix for module.run show result as True when module returned False as result Mar 26, 2025
twangboy
twangboy previously approved these changes Mar 26, 2025
@SndR85
Copy link
Contributor Author

SndR85 commented Mar 26, 2025

@twangboy I found another flaw in the current change I made. When the result is set to a non-boolean value it will be automatically set to False. I think I should check if result is a boolean.

@SndR85
Copy link
Contributor Author

SndR85 commented Mar 26, 2025

I have fixed it, I won't change anything for now unless a maintainer or CI does not agree with current change. Personally I think as a bonus the change is now more readable.

@hurzhurz
Copy link
Contributor

I also already made a PR for the same issue a while ago which is waiting for merging. Maybe you could have a look at it: #67115
And I choose 3006.x instead of master as target branch, so it will be fixed in a 3006 release. From there it should find its way to master automatically.

@twangboy twangboy added this to the Argon v3008.0 milestone Mar 26, 2025
@twangboy
Copy link
Contributor

Just need to migrate that test to pytest on #67115

@SndR85
Copy link
Contributor Author

SndR85 commented Mar 27, 2025

Close as #67115 seems to be a better fix and code cleanup.

@SndR85 SndR85 closed this Mar 27, 2025
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.

Module.run state returns invalid result when method returns a dict
3 participants