Shell provisioner: invalid character '*' after array element

12 views
Skip to first unread message

Tekchand Dagar

unread,
Aug 14, 2019, 1:18:18 AM8/14/19
to Packer
Hello Team,

I am encoding my ruby code using rubyencoder and its create ".bak" file which contain our actual code. So i need to delete all the ".bak" extension file. I am using shell provisioner to do this. Below is my shell provisioner:

{
    "type": "shell",
    "inline": [
        "sleep 10",
        "sudo /home/deploy/rubyencoder-evaluation/bin/rubyencoder -r /home/deploy/mobilock-app/app/controllers/",
        "sudo find /home/deploy/mobilock-app/app/controllers/ -type f -name "*.bak" -delete"
       ]
},


But when i am validating my .json file i am getting below error:

Failed to parse template: Error parsing JSON: invalid character '*' after array element
At line 115, column 79 (offset 3858):
  114:         "sudo /home/deploy/rubyencoder-evaluation/bin/rubyencoder -r /home/deploy/mobilock-app/app/controllers/",
  115:         "sudo find /home/deploy/mobilock-app/app/controllers/ -type f -name "*
                                                                                    ^


Can you please help me to fix this issue.

Thanks.

Rickard von Essen

unread,
Aug 14, 2019, 2:22:19 AM8/14/19
to packe...@googlegroups.com
You need to escape double quotes in json with \.

I recommend that you don't use inline for anything but trivial commands, instead use scripts. 

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/15181494-93e1-45b5-acc2-41d4276ee0a5%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages