so would this consider as me contributing to packer :D On Wednesday, January 9, 2019 at 12:52:16 PM UTC-5, Megan Marsh wrote: > > I think this is a pretty useful question so I've made a PR adding docs for > how to do this (including env vars!) here: > https://github.com/hashicorp/packer/pull/7181/files > > On Wed, Jan 9, 2019 at 9:21 AM Megan Marsh <[email protected] > <javascript:>> wrote: > >> You can also use python in your execute_command; the example below works >> on my mac; python is in my path and the script "hello.py" is in my working >> directory >> >> { >> "builders": [ >> { >> "type": "null", >> "communicator": "none" >> } >> ], >> "provisioners": [ >> { >> "type": "shell-local", >> "script": "hello.py", >> "execute_command": ["python", "{{.Script}}"] >> } >> ] >> } >> >> Here's the command and output from the above example: >> >> $ packer build shell_local_python.json >> null output will be in this color. >> >> ==> null: Running local shell script: hello.py >> null: Hello, world! >> Build 'null' finished. >> >> ==> Builds finished. The artifacts of successful builds are: >> --> null: Did not export anything. This is the null builder >> >> On Wed, Jan 9, 2019 at 9:01 AM Rickard von Essen <[email protected] >> <javascript:>> wrote: >> >>> That should work, assuming your python script is executable and have a >>> proper shebang. >>> >>> On Wed, Jan 9, 2019 at 5:48 PM Ibrahim Buamod <[email protected] >>> <javascript:>> wrote: >>> >>>> It is a question ? how can I run a python script locally >>>> >>>> On Wednesday, January 9, 2019 at 11:44:51 AM UTC-5, Ibrahim Buamod >>>> wrote: >>>>> >>>>> Yes .. sorry for the poor presentation >>>>> >>>>> On Wednesday, January 9, 2019 at 11:43:11 AM UTC-5, Rickard von Essen >>>>> wrote: >>>>>> >>>>>> Is that a question? >>>>>> >>>>>> On Wed, Jan 9, 2019, 17:34 Ibrahim Buamod <[email protected] >>>>>> wrote: >>>>>> >>>>>>> run python script in shell-local >>>>>>> >>>>>>> >>>>>>> "provisioners": [ >>>>>>> { >>>>>>> "type": "shell-local", >>>>>>> "environment_vars": ["VM_NAME={{user `Name`}}"], >>>>>>> "execute_command": ["bash", "-c", "{{.Vars}} {{.Script}}"], >>>>>>> "script": "./abc.py" >>>>>>> } >>>>>>> >>>>>>> -- >>>>>>> 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/d4b1d147-50f2-4c23-a6df-9a128ff3f637%40googlegroups.com >>>>>>> >>>>>>> <https://groups.google.com/d/msgid/packer-tool/d4b1d147-50f2-4c23-a6df-9a128ff3f637%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] <javascript:>. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/packer-tool/968b0d86-92ce-44d8-9aec-8d48059c8856%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/packer-tool/968b0d86-92ce-44d8-9aec-8d48059c8856%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] <javascript:>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/packer-tool/CALz9Rt_RX9Z8kC5vPsnxyHJFd02h0Cisci4S5hT5rgves%3DkCUg%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt_RX9Z8kC5vPsnxyHJFd02h0Cisci4S5hT5rgves%3DkCUg%40mail.gmail.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/d631a3d6-097e-4e05-9cf0-38439ae2cf20%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
