-
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
Fix packer vsphere-iso builder folder path #9328
Comments
Thanks for creating this David, does anyone have have any idea what the generalised fix might be? |
What data are you putting into the datacenter field? |
I'm wondering if we can pull out the VM folder for the datacenter like this: folders, err := d.datacenter.Folders(d.ctx)
if err != nil{
return nil, err
}
folders.VmFolder.String() |
@sqqqrly please check to see if this fixes your issue. I don't have an environment with multiple data centers. |
As this fix is now part of the nighty build it was quick to test it as I have a nested infra, and I'm still running on the same issue. Can someone else confirm? Can I be of any help for additional tests? |
@TmCTux can you post the packer log from your test? it could also be useful to see what https://github.com/vmware/govmomi/blob/master/govc/USAGE.md#folderinfo shows for the vm folder on your datacenter. |
Hello @jhawk28,
thanks for answering.
at the root of our vcenter there are regional folder, one is called
<Reg_folder> below, then the datacenter <DC_NAME>
I'm using vsphere-iso builder as below,
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "{{user `vsphere_server`}}",
"username": "{{user `vsphere_user`}}",
"password": "{{user `vsphere_password`}}",
"insecure_connection": "true",
"datacenter": "{{user `vsphere_dc`}}",
"cluster": "{{user `vsphere_cluster`}}",
[...]
and
"vsphere_dc": "<DC_NAME>",
Here is the packer output of my test:
vsphere-iso: output will be in this color.
==> vsphere-iso: Creating VM...
Build 'vsphere-iso' errored: error creating vm: folder '/<DC_NAME>/vm/' not
found
==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error creating vm: folder '/<DC_NAME>/vm/' not found
==> Builds finished but no artifacts were created.
Here is the folder.info
govc folder.info /<Reg_folder>/<DC_NAME>/vm
Name: vm
Path: /<Reg_folder>/<DC_NAME>/vm
Types: Folder,VirtualMachine,VirtualApp
Children: 22
For info, <DC_NAME> should in my opinion only hold the name of the
datactenter only but I've tested with <Reg_folder>/<DC_NAME> and
/<Reg_folder>/<DC_NAME> also, it produced exactly the same output (thus
without mentioning the top folder <Reg_folder>. I'm thinking it wouldn't be
bad to have a way to specify that top folder somewhere. For info, I'm using
terraform to deploy machines then, and it handles that extra top folder
fine - and it is specified upfront.
Thanks again, let me know if I can be of further help, I'd be glad to.
|
I think this is indicating that the datacenter is being found. I think that I found the difference between packer and terraform. I'll push a fix to test it out. |
I've tested the fix, it looks a lot better 😃. It still fails but I believe its unrelated - my template is a work in progress, but at least it found the vm folder now! Thanks for the fast answer. |
@jhawk28: This does not fix my problem.
The folder path should be |
@sqqqrly I don't think #9390 has been merged in yet. Can you build from the bug_8766 branch? Or use an artifact from the pull request: https://app.circleci.com/pipelines/github/hashicorp/packer/5549/workflows/c28c6870-ec5a-4f54-a180-9abd35c3133c/jobs/58799/artifacts |
@jhawk28 OK. This works but seems a little strange. To make it work I needed If I just use The path that is not found is what I expect to be the correct path. How come?
|
@sqqqrly try using a folder that already exists |
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. |
Overview of the Issue
If one's vSphere uses a "folder of datacenters" rather than just a single data center, the vsphere-iso builder fails. This is due to an assumption that is not met for the full path in the FindFolder function (
packer/builder/vsphere/driver/folder.go
Line 24 in 93d4d63
There is an older related bug report: jetbrains-infra/packer-builder-vsphere#285
Reproduction Steps
In your vSphere, hosts and clusters tab, use an extra folder:
Packer version
1.6.0
Simplified Packer Buildfile
Ubuntu Bionic
Hack to work around
The text was updated successfully, but these errors were encountered: