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
states.hg.latest claims to succeed despite errors #36553
Comments
@nilliams Thanks again for filing this. We're probably just not catching the error correctly and propagating it up to the state run to fail correctly. I can grab this one really quickly, too. I can grab it likely sometime tomorrow. |
Fixes saltstack#36553 The hg.present state was not checking for errors for any of the calls to the hg.py execution module functions. All of the hg.py execution module functions were using cmd.run, instead of cmd.run_all, which allowed for hg.py execution module functions to log an error at the CLI but the hg.present state would return True, even though there were problems executing the module functions. This change adds try/except blocks around the calls to the mercurial execution module functions and retuns False when a CommandExecutionError is raised by the module. The module has been changes to use cmd.run_all instead of cmd.run in order to check for the retcode of the underlying mercurial calls and raises a CommandExecutionError is the retcode != 0.
Yes that works for me, fails hard now, thank you @rallytime!
|
Hrm...I could probably clean up stack trace in your state output. That's not very pretty... |
Hehe I guess, I'm new to Salt so wasn't really sure what to expect there. Feel free to shout me to try out changes. |
@nilliams Can you tell me how you updated to test this? It seems to me like you have updated the execution module, but not the hg.py state. Updating the hg.py state as well as the execution module should clean up those stacktraces in your state return. |
Sorry, my bad! Great diagnosis of my dumbness! Yes it works if I actually update properly and use the state too:
EDIT that was actually an example of a diff error, failing on the
|
Excellent! Thanks for confirming! I'll close this up. |
Description of Issue/Question
Despite seeing errors from the
hg
command (which were my fault), the formatted salt report thing says that the statehg.latest
succeeded.Setup
Steps to Reproduce Issue
In this example I've accidentally left an untracked file
salt/mercurial.sls
lying around in the checkout, which (correctly) fails thehg update
with errors, however as you see the salt report claims it succeeded.Versions Report
I'm running salt at this previous PR re: states.hg, but I did check the same thing happens with the latest release via salt-bootstrap.sh too (
2016.3.3
).The text was updated successfully, but these errors were encountered: