Search code examples
bashpuppetexit-coderundeck

puppet exit code 2 while expecting 0 with rundeck


I'm trying to run a task in rundeck that runs a "puppet agent -tod", but since puppet returns an exit code of 2, which means it applied some changes as seen on https://docs.puppetlabs.com/references/3.4.2/man/agent.html at --detailed-exitcodes section, but rundeck all that is different from 0 marks it as failed. Can I force in some way to show a 0 exit code instead of 2?

Thank you all!


Solution

  • You can run a modified command, such as

    puppet agent -tod || test $? -eq 2
    

    That supposes that rundeck will run it via the shell, of which I am uncertain. If it wants a command it can execute directly then you could use

    bash -c 'puppet agent -tod || test $? -eq 2'