hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.08k stars 3.33k forks source link

Unable to pass arguments - python script - shell provisioner- packer -environment variables #10307

Closed sededg closed 4 months ago

sededg commented 3 years ago

I am trying to pass arguments on python script using shell provisioner, am i missing anything?

packer --version 1.6.4

Packer code: "provisioners": [ { "type": "shell-local", "script": "python.py", "environment_vars": [ "pyt_name=pytname", "pyt_arch=64-bit" ], "execute_command": [ "/bin/bash", "-c", "{{.Vars}} /usr/bin/python {{.Script}}" ] } Debug log Error: ==> vsphere-clone: usage: python.py [-h] --pyt_name PYT_NAME --pyt_arch PYT_ARCH ==> vsphere-clone: python.py: error: argument --pyt_name is required

SwampDragons commented 3 years ago

It looks like you're setting those variables as environment vars, but the python.py script expects them as arguments rather than env vars.

tenthirtyam commented 7 months ago

Recommend closure.

cc @nywilken

lbajolet-hashicorp commented 4 months ago

Good catch @tenthirtyam, we can indeed close this one since there hasn't been any update for years.

github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.