Issue with ordering of provisioner steps

52 views
Skip to first unread message

Chad Willman

unread,
Aug 15, 2017, 11:07:34 AM8/15/17
to Packer

I'm seeing a problem where packer is trying to execute a 'file' provisioner step, before it executes the 'shell-local' provisioner step that creates the file.
Even after converting my provisioner list to match the example on this page -  https://www.packer.io/docs/provisioners/file.html, packer always tries to
execute the 'file' step before ever executing the 'shell-local' step.

I've not found any help in documentation or other groups on line, so if there's a place I should be posting this question, please let me know.

Any other help is appreciated.

CW

Rickard von Essen

unread,
Aug 15, 2017, 12:44:48 PM8/15/17
to packe...@googlegroups.com
The provisioners section should be a list and will execute in order. Can you attach the template you try to use? 

--
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/0a639276-6783-47b2-b7c1-d4878c81d4d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chad Willman

unread,
Aug 15, 2017, 2:04:16 PM8/15/17
to packe...@googlegroups.com
Yes, I've read the documentation. But the fact is that this JSON excerpt below from the packer docs does not work - https://www.packer.io/docs/provisioners/file.html

The 'file' provisioner ignores the fact that its source directive is being created by the 'shell-local' directive. Packer fails this JSON config, as is, unmodified.



{
  "provisioners": [
    {
      "type": "shell-local",
      "command": "mkdir -p toupload; tar cf toupload/files.tar files"
    },
    {
      "destination": "/tmp/",
      "source": "./toupload",
      "type": "file"
    },
    {
      "inline": [
        "cd /tmp && tar xf toupload/files.tar",
        "rm toupload/files.tar"
      ],
      "type": "shell"
    }
  ]
}

You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/LudHDo1QZ7U/unsubscribe.
To unsubscribe from this group and all its topics, 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/CALz9Rt-OfGLFWGsZJbnqK01GisvfzCyM2LwZ1Xk%3Dx5UZBPfqYA%40mail.gmail.com.

Rickard von Essen

unread,
Aug 15, 2017, 2:22:41 PM8/15/17
to packe...@googlegroups.com
Don't have a computer right now... But I guess it fails on "packer validate", packer requires that you have have all source files/dirs in the file privisioner before building. But the example you give should work if you create the "toupload" dir before you run packer. 

Chad Willman

unread,
Aug 15, 2017, 2:27:35 PM8/15/17
to packe...@googlegroups.com
But that just it, the 'to upload directory gets created in the 'shell-local' provisioner, not before running packer. If you have to create the 'to upload' directory before running packer, what's the point of the 'mkdir -p to upload in the 'shell-local' provisioner ?

Rickard von Essen

unread,
Aug 15, 2017, 3:38:22 PM8/15/17
to packe...@googlegroups.com
Yes that is kind of misleading. 

Reply all
Reply to author
Forward
0 new messages