1. No

2. No. To do something like that you have to wrap your script in another
script that will execute appropriate cleanup tasks*). This only works in a
shell provisioner. If you rely on another provisioner you might manipulate
the execute_command to write down the exit code to a file and ignore
expected exit codes. And then run a script that do appropriate cleanup and
reuse the exit code from the previous provisioner.

*) http://www.tldp.org/LDP/abs/html/abs-guide.html#TRAPREF1

On 12 June 2017 at 17:21, Vamshi krishna <[email protected]> wrote:

>
>    1. Is it possible to store the output of an inline shell command in a
>    packer variable?  I have looked into docs and have not found a proper
>    example of doing it.
>    2. Is it possible to run shell provisioner even if other provisioners
>    fails to execute or throw an exit code 1 ?
>
> one of my provisioner runs chef-client and if it succeeds I won't have any
> problems but if it fails the packer exit's with code 1. my subsequent
> provisioners are `deleting the node and client` from the chef server. I
> want these commands to be executed even if the first provisioner fails.
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/41c7834d-6f30-4cf1-a6eb-a33335e99b34%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/41c7834d-6f30-4cf1-a6eb-a33335e99b34%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt9BJ%2BkRmgOf2DBrhCeeZjAXok2M8%3D052kwVi_F_%3D6t0Hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to