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 for broken salt cmd return codes - issue #7013 #11337

Merged
merged 9 commits into from
Mar 22, 2014

Conversation

techdragon
Copy link
Contributor

  • new test related states that can be used to provide success / failure on request.
  • fixed the broken logic chain that handles return codes
    both when the minion decides what retcode to propagate to the master
    and when the master decides what return code to return to the invoked salt cmd
  • added new log.debug and log.trace statements to assist with further work on ensuring return
    codes are properly handled by all components of salt.
  • should fix Salt exit codes are inconsistent and undocumented #7013

- new test related states that can be used to provide success / failure on request.
- fixed the broken logic chain that handles return codes
both when the minion decides what retcode to propagate to the master
and when the master decides what return code to return to the invoked salt cmd
- added new log.debug and log.trace statements to assist with further work on ensuring return
codes are properly handled by all components of salt.
@ghost
Copy link

ghost commented Mar 18, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2514/

Build Log
last 15 lines

[...truncated 27 lines...]
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:416)
    at hudson.plugins.git.GitAPI.revParse(GitAPI.java:257)
    at hudson.plugins.git.RevisionParameterAction.toRevision(RevisionParameterAction.java:83)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:787)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1414)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:671)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:580)
    at com.tikal.jenkins.plugins.multijob.MultiJobBuild$MultiJobRunnerImpl.run(MultiJobBuild.java:134)
    at hudson.model.Run.execute(Run.java:1676)
    at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:73)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:231)

@ghost
Copy link

ghost commented Mar 18, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2516/

Build Log
last 15 lines

[...truncated 16 lines...]
Seen branch in repository origin/develop
Seen branch in repository origin/no_ipv6
Seen branch in repository origin/pillar_mod
Seen 11 remote branches
Checking out Revision a5153ba0c83f54e00aaa92832b04961bfedf0eaf (origin/develop)
Starting build job salt-pr-rs-ubuntu12.04.
Starting build job salt-pr-lint.
Finished Build : #2069 of Job : salt-pr-rs-ubuntu12.04 with status :FAILURE
Finished Build : #2201 of Job : salt-pr-lint with status :FAILURE
Build step 'MultiJob Phase' marked build as failure

Deleting project workspace... 
done

@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2533/

@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2534/

@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2535/

- Fixed bad logic in data handling block.
- Fixed and refactored the test state to be
 more complete and in line with coding standards.
@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2543/

- Added newlines to fix E8302(expected-2-blank-lines,-found-0)
- Disabled pylint checks for E8712(comparison-to-True-should-be-'if-cond-is-True:'-or-'if-cond:') and documented my reason
@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2544/

@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2545/

@techdragon
Copy link
Contributor Author

The console log doesnt provide enough information on why the profile error is being propagated. Investigating back through the salt cloud code in order to identify a possible cause of the error.

Error: There was a profile error: Executing the command '/tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud -D -g https://github.com/techdragon/salt.git -n git 024169128f0ed5f4fbf6ce55737e6eadc33e249c' failed

http://jenkins.saltstack.com/job/salt-pr-rs-ubuntu12.04/2091/consoleFull

err = 'All Minions did not return a retcode of 0. One or more minions had a problem'
# NOTE: This could probably be made more informative.
# I chose 11 since its not in use.
raise SaltSystemExit(code=11, msg=err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not want to raise an error like this, but just return with the error return code, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean just passing on the return code that is generated from the minion. The problem is what to do when you get multiple different return codes. For instance one minion has no errors, another has a single state return retcode 1, another minion returns retcode 2. How to represent this? I've been contemplating options on how to provide the information and feel that given the possible permutations we really have little option as far as the process return/exit code but to choose a distinct error code for this 'minion failures' use case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no, I like your approach with a static exit code! I just think we should use sys.exit instead of raise SaltSystemExit

@thatch45
Copy link
Contributor

Sorry about the test system failures, we were having issues yesterday with the rackspace API (or rather, they stopped working for some 20+ hours)
I am going to try and get this to test again.

@thatch45 thatch45 closed this Mar 19, 2014
@thatch45 thatch45 reopened this Mar 19, 2014
@ghost
Copy link

ghost commented Mar 19, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2551/

@techdragon
Copy link
Contributor Author

Still getting issues with the bootstraping code failing.

Error: There was a profile error: Executing the command '/tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud -D -g https://github.com/techdragon/salt.git -n git 024169128f0ed5f4fbf6ce55737e6eadc33e249c' failed

But it seems the cause is #11338 and #11357
since the last line before the failure is
package init file 'salt/templates/__init__.py' not found (or not a regular file)

@ghost
Copy link

ghost commented Mar 20, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2567/

- fixed pep8 issue
- added more logic to check_state_result logic to handle list results properly and return false.
- ordered the check_state_result unit tests more logically. All the data type tests are now before the content & logic handling checks
- discovered duplicate test in check_state_result unit tests and removed it, both tests were asserting using the same data {'host': []}
@ghost
Copy link

ghost commented Mar 20, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2568/

thatch45 added a commit that referenced this pull request Mar 22, 2014
@thatch45 thatch45 merged commit 4af873d into saltstack:develop Mar 22, 2014
'new': 'Were pretending really hard that we changed something'
}
}
elif changes == True: # pylint: disable=E8712
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would

 elif changes is True:

be less readable?

@kiorky
Copy link
Contributor

kiorky commented Mar 26, 2014

I think this breaked the saltmod module

@kiorky
Copy link
Contributor

kiorky commented Mar 26, 2014

cc @thatch45 .

@kiorky
Copy link
Contributor

kiorky commented Mar 26, 2014

we used to check the highstate return in this way:

  m_state = salt.utils.check_state_result({minionid: m_ret})  

and it seems that now the function waits, something like that:

  m_state = salt.utils.check_state_result(m_ret)  

@kiorky
Copy link
Contributor

kiorky commented Mar 26, 2014

Im sending a PR but it would be good to have a confirmation on this

@nw0428
Copy link

nw0428 commented Apr 28, 2014

Was this actually fixed? Currently "salt-call state.highstate" always returns 0 for me!

@basepi
Copy link
Contributor

basepi commented Apr 28, 2014

@nw0428 which version of salt?

@basepi
Copy link
Contributor

basepi commented Apr 28, 2014

@nw0428 I think this only goes live in the next feature release (codenamed Helium) -- so you'll only see the new behavior if you're running off of the develop branch.

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.

Salt exit codes are inconsistent and undocumented
6 participants