See https://packer.io/docs/provisioners/shell.html
On Thu, Jan 17, 2019 at 3:04 PM Rickard von Essen < [email protected]> wrote: > > Instead of adding sudo in the inline command I would do change the > execute_command: > > { > "type": "shell", > "environment_vars": [ > "destinationFolder=/tmp", > "PersonalAccessToken=S3cret" > ], > "inline": [ > "python /tmp/pythonscript.py" > ], > "execute_command": "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" > } > > > On Thu, Jan 17, 2019 at 4:01 AM goffries <[email protected]> wrote: > >> I'm trying to run a python script in Shell and I'm having trouble getting >> the script to access the environment variables. Is something like this even >> valid? >> >> { >> "type": "shell", >> "environment_vars": [ >> "destinationFolder={{user `scriptTargetPath`}}", >> "PersonalAccessToken={{user `PersonalAccessToken`}}" >> ], >> "inline": [ >> "sudo python /tmp/pythonscript.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/edf7a1c4-c077-4498-bfc5-7d279ba80b0c%40googlegroups.com >> <https://groups.google.com/d/msgid/packer-tool/edf7a1c4-c077-4498-bfc5-7d279ba80b0c%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/CALz9Rt9vYuYYwMJa-COgBGhyZgM%2B8FXr5%3DNbGATHFj0q-1qapw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
