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

jenkins_user_api module doesn't catch non-zero exit codes in some circumstances #151

Closed
robled opened this issue Sep 1, 2017 · 2 comments
Assignees

Comments

@robled
Copy link
Contributor

robled commented Sep 1, 2017

Consider the following example where we try to retrieve a user API key:

$ java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080 groovy groovy.groovy

ERROR: This command is requesting the deprecated -remoting mode. See https://jenkins.io/redirect/cli-command-requires-channel

$ echo $?
5

On Jenkins versions > 2.46.2 the -remoting flag is needed to make this command work, but somehow the jenkins_user_api module doesn't report an error for the non-zero exit code, at least in this circumstance. There is code in jenkins_user_api to handle this case, but someone it's not working as expected.

@greg-hellings greg-hellings self-assigned this Sep 16, 2017
@greg-hellings
Copy link
Contributor

I believe I see what's going on here. While we are properly checking for the value of the exit code, we are not properly calling module.fail_json when the error occurs.

@greg-hellings
Copy link
Contributor

Also, I will note that the importance of this has already been worked around in cinch by checking for the need of the -remoting flag, but the module should still be fixed for future conditions that might arise.

greg-hellings added a commit to greg-hellings/cinch that referenced this issue Sep 16, 2017
The jenkins_user_api module was not properly capturing errors and
incorrect exit codes when the module was being executed improperly. Now,
more of those cases should be handled properly and trigger an error
state in Ansible.

Fixes: RedHatQE#151
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

No branches or pull requests

2 participants