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

Any error in CLI causes the entire puppet run to abort #823

Open
nick-george opened this issue Nov 29, 2017 · 1 comment
Open

Any error in CLI causes the entire puppet run to abort #823

nick-george opened this issue Nov 29, 2017 · 1 comment

Comments

@nick-george
Copy link

nick-george commented Nov 29, 2017

Hi,

I've been using this module to call the Jenkins CLI. Any error in a CLI call causes the entire puppet run to abort. This is causing me major issues because it's stopping updates from other modules being applied to this box (not just Jenkins related changes). This issue is being compounded by #807 because I'm in a situation where Jenkins is being restarted on every single puppet run, and it does not start back up fast enough for the CLI to succeed. The end result is that every single puppet run on this box (which happens to be my puppet master) is failing.

Steps to reproduce.

  1. Deliberately corrupt the jenkins-cli.jar
echo '' | sudo tee /usr/lib/jenkins/jenkins-cli.jar
  1. Run puppet
Info: Applying configuration version '1511991992'
Notice: /Service[jenkins]/ensure: ensure changed 'running' to 'stopped'
Notice: /Stage[main]/Jenkins/Jenkins::Systemd[jenkins]/Transition[stop jenkins service]/enable: transition state {"ensure"=>"stopped"} applied to Service[jenkins]
Notice: /Stage[main]/Jenkins::Service/Service[jenkins]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Jenkins::Service/Service[jenkins]: Unscheduling refresh on Service[jenkins]
Error: Failed to apply catalog: Execution of '/bin/cat /usr/lib/jenkins/puppet_helper.groovy | /bin/java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://localhost:8080 groovy = user_info_all' returned 1: Error: Invalid or corrupt jarfile /usr/lib/jenkins/jenkins-cli.jar

Is there any chance of having this behaviour changed so that it only prints a warning?

Cheers,
Nick

@jhoblitt
Copy link
Member

CLI errors are not fatal to the entire puppet run, at least for me, as long as there are other resources that need to be converged that are no not dependent on the jenkins types.

The only way to avoid an error from the provider would be for it to be determined to be unsuitable. That would result in an error from the type that there's no suitable provider. A sanity check would need to support doing auth as well or it would fail for most users. It should be possible to add a sanity check in lib/puppet/x/jenkins/provider/cli.rb and have all the providers inherit it. That said, I'm not personally interested in working on this as it would just move the error around (without alternative providers) but I would be willing to merge a PR.

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