packer.io exit code of provisioning script

1

I got packer.io for building VM images. I provision VMs with shell script which uses puppet.

Now sometimes there is situation where this provisioning script fails to provision VM correctly.

I am using Rundeck to trigger provisioning by packer.

I need a way how to tell Rundeck that provisioning script inside VM failed.

I haven't found anything in documentation of packer.io according this issue.

David Strejc

Posted 2015-09-01T13:46:57.987

Reputation: 101

Answers

0

This was due to different handling of exit codes from puppet.

I had to use:

puppet apply --detailed-exitcodes /etc/puppet/modules/...
            if [[ $? != 2 ]]  
            then
                exit 1
            fi
            ;;

This indicates to packer.io right exit code 1 when puppet not finishes with "everything went well" exit code 2.

David Strejc

Posted 2015-09-01T13:46:57.987

Reputation: 101