Have certain packer stages always run even on failure earlier in build.

13 views
Skip to first unread message

James Bailey

unread,
Apr 12, 2017, 6:06:09 AM4/12/17
to Packer
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

Rickard von Essen

unread,
Apr 12, 2017, 6:53:33 AM4/12/17
to packe...@googlegroups.com
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

--
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/b5ebad25-af09-479e-9e27-8c2e54b961ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages