There is no direct support for this if you need it to span multiple provisioners.
I would sugest that you write some metadata to a file and use the file provisioner to download it and wrap your packer run in a script that uses that to unregister the subscription after packer has completed regardless of the outcome. // Rickard On 12 April 2017 at 12:06, James Bailey <[email protected]> wrote: > Hello, > > I trying to find a way a stage will always run even on failure. We are > building RHEL7 instances in packer. At the beginning of the run we run > subscription manager to register and add repos at the end of the run we > deregister the instance. This works well on a successful build but if any > stage in between fails we end up with wasted subscriptions which have to be > cleaned up manually. The packer json files for RHEL images currently follow > this structure. > > > - shell: add CA files, register with Satellite server, add repos, add > RHN packages > - puppet: role and profiles executed > - shell: register image with consul > - shell: unsubs from Satellite server > > Many thanks for any advice or pointers in the docs. > > > Jim > > -- > 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/b5ebad25-af09-479e-9e27-8c2e54b961ad%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/b5ebad25-af09-479e-9e27-8c2e54b961ad%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/CALz9Rt_dXRnY%3D3Z30O9smhu2cKESbPs7vBv89u-brMeijEL7SA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
