-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packer option -var-file=path interpretated with double backslashe #12726
Comments
Hi @spawn451, The escaped The error you're getting is likely to be something else here, unfortunately the hcl library which implements the code producing the diagnostic you see does not include the error in its output, which I'll submit a PR for soon. If accepted we'll get more insight in the problem itself. Aside from that, I think you may have a usage problem, I presume the first error is thrown by Thanks! |
Hello thanks! After carefully reading the log, I noticed that the escaped for the $VSPHERE_FILE = "$CONFIG_PATH\builds\vsphere.pkrvars.hcl"
... for the |
Hi @spawn451, I closed the issue since from the last message you shared this looks like it was fixed, and not a Packer bug. Feel free to reopen if I'm mistaken! |
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. |
Community Note
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
I'm trying to run Packer from a Powershell script. I use the
-var-file=path
option to specify the path of my HCL configuration files.This does not work, Packer can't read the files because the specified paths are always interpreted with double backslashes.
Reproduction Steps
Sample of my powershell script :
Output :
Packer version
From
1.9.4
Operating system and Environment details
Windows 10 22H2
Log Fragments and crash.log files
log detail.
PS D:\_DevOps\_Packer\templates-vmware_v2> D:\_DevOps\_Packer\templates-vmware_v2\build.ps1 packer : 2023/11/30 11:43:17 [INFO] Packer version: 1.9.4 [go1.20.7 windows amd64] Au caractère D:\_DevOps\_Packer\templates-vmware_v2\build.ps1:47 : 1 + packer init $INPUT_PATH + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (2023/11/30 11:4... windows amd64]:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError2023/11/30 11:43:17 [TRACE] discovering plugins in C:\Program Files\HashiCorp
2023/11/30 11:43:17 [TRACE] discovering plugins in .
2023/11/30 11:43:17 [TRACE] discovering plugins in C:\Users\DJE\AppData\Roaming\packer.d\plugins
2023/11/30 11:43:17 [INFO] Discovered potential plugin: ansible = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\hashicorp\ansible\packer-plugin-ansible_v1.1.1_x5.0_windows_amd64.exe
2023/11/30 11:43:17 [INFO] Discovered potential plugin: vsphere = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vsphere\packer-plugin-vsphere_v1.2.2_x5.0_windows_amd64.exe
2023/11/30 11:43:17 [INFO] Discovered potential plugin: windows-update = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\rgl\windows-update\packer-plugin-windows-update_v0.14.3_x5.0_windows_amd64.exe
2023/11/30 11:43:17 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2023/11/30 11:43:18 [INFO] found external [clone iso supervisor] builders from vsphere plugin
2023/11/30 11:43:18 [INFO] found external [-packer-default-plugin-name- template] post-processors from vsphere plugin
2023/11/30 11:43:18 found external [-packer-default-plugin-name-] provisioner from windows-update plugin
2023/11/30 11:43:18 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/11/30 11:43:18 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\DJE\AppData\Roaming\packer.config
2023/11/30 11:43:18 [WARN] Config file doesn't exist: C:\Users\DJE\AppData\Roaming\packer.config
2023/11/30 11:43:18 [INFO] Setting cache directory: D:_DevOps_Packer\templates-vmware_v2\packer_cache
e: cannot determine if process is in background: Process background check error: not implemented yet
2023/11/30 11:43:18 [TRACE] init: plugingetter.ListInstallationsOptions{FromFolders:[]string{"C:\Program Files\HashiCorp", ".", "C:\Users\DJE\AppData\Roaming\packer.d\plugins"},
BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"windows", ARCH:"amd64", Ext:".exe", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256",
Hash:(*sha256.digest)(0xc0004ea480)}}}}
2023/11/30 11:43:18 [TRACE] listing potential installations for "github.com/hashicorp/vsphere" that match ">= 1.2.1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"C:\Program Files\HashiCorp", ".",
"C:\Users\DJE\AppData\Roaming\packer.d\plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"windows", ARCH:"amd64", Ext:".exe",
Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0004ea480)}}}}
2023/11/30 11:43:18 [TRACE] for plugin github.com/hashicorp/vsphere found 1 matching installation(s)
2023/11/30 11:43:18 [TRACE] listing potential installations for "github.com/rgl/windows-update" that match ">= 0.14.3". plugingetter.ListInstallationsOptions{FromFolders:[]string{"C:\Program Files\HashiCorp", ".",
"C:\Users\DJE\AppData\Roaming\packer.d\plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"windows", ARCH:"amd64", Ext:".exe",
Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0004ea480)}}}}
2023/11/30 11:43:18 [TRACE] for plugin github.com/rgl/windows-update found 1 matching installation(s)
2023/11/30 11:43:18 [INFO] (telemetry) Finalizing.
2023/11/30 11:43:18 waiting for all plugin processes to complete...
packer : 2023/11/30 11:43:19 [INFO] Packer version: 1.9.4 [go1.20.7 windows amd64]
Au caractère D:_DevOps_Packer\templates-vmware_v2\build.ps1:49 : 1
2023/11/30 11:43:19 [TRACE] discovering plugins in C:\Program Files\HashiCorp
2023/11/30 11:43:19 [TRACE] discovering plugins in .
2023/11/30 11:43:19 [TRACE] discovering plugins in C:\Users\DJE\AppData\Roaming\packer.d\plugins
2023/11/30 11:43:19 [INFO] Discovered potential plugin: ansible = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\hashicorp\ansible\packer-plugin-ansible_v1.1.1_x5.0_windows_amd64.exe
2023/11/30 11:43:19 [INFO] Discovered potential plugin: vsphere = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vsphere\packer-plugin-vsphere_v1.2.2_x5.0_windows_amd64.exe
2023/11/30 11:43:19 [INFO] Discovered potential plugin: windows-update = C:\Users\DJE\AppData\Roaming\packer.d\plugins\github.com\rgl\windows-update\packer-plugin-windows-update_v0.14.3_x5.0_windows_amd64.exe
2023/11/30 11:43:19 [INFO] found external [clone iso supervisor] builders from vsphere plugin
2023/11/30 11:43:19 [INFO] found external [-packer-default-plugin-name- template] post-processors from vsphere plugin
2023/11/30 11:43:19 found external [-packer-default-plugin-name-] provisioner from windows-update plugin
2023/11/30 11:43:19 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2023/11/30 11:43:19 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/11/30 11:43:19 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\DJE\AppData\Roaming\packer.config
2023/11/30 11:43:19 [WARN] Config file doesn't exist: C:\Users\DJE\AppData\Roaming\packer.config
2023/11/30 11:43:19 [INFO] Setting cache directory: D:_DevOps_Packer\templates-vmware_v2\packer_cache
e: cannot determine if process is in background: Process background check error: not implemented yet
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\vsphere.pkrvars.hcl" could not be
read.
Error: Failed to read file
Error: Failed to read file
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\vault.pkr.hcl" could not be read.
Error: Failed to read file
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\common.pkrvars.hcl" could not be
read.
2023/11/30 11:43:19 [INFO] (telemetry) Finalizing.
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\vsphere.pkrvars.hcl" could not be
read.
Error: Failed to read file
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\vault.pkr.hcl" could not be read.
Error: Failed to read file
The configuration file
"D:\_DevOps\_Packer\templates-vmware_v2\common.pkrvars.hcl" could not be
read.
2023/11/30 11:43:19 waiting for all plugin processes to complete...
The text was updated successfully, but these errors were encountered: