Skip to content
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

post-processor vsphere: "error destroying builder artifact" #279

Open
jaymzmac opened this issue May 16, 2023 · 1 comment
Open

post-processor vsphere: "error destroying builder artifact" #279

jaymzmac opened this issue May 16, 2023 · 1 comment

Comments

@jaymzmac
Copy link

Overview of the Issue

After running the vsphere post-processor, the packer build fails while trying to clean up the artifact:

Error destroying builder artifact: reading body msgpack decode error [pos 940]: reflect.Set: value of type map[interface {}]interface {} is not assignable to type error; bad artifact: []string(nil)

The OVF is successfully uploaded to vCenter, and the VM files (.ovf, .vmdk, etc) are successfully deleted from the local filesystem where packer runs, but nonetheless the build fails and exits with code 1.

If I set keep_input_artifact to true, then the build completes successfully with no errors, but obviously the VM files are kept on the local filesystem.

This bug report is perhaps a duplicate (hashicorp/packer#11101).

Reproduction Steps

Configure the vsphere post-processor as per the simplified buildfile provided below. Ensure the keep_input_artifact option is set to false (which is the default setting) in order to reproduce the issue.

Packer Version

1.8.7

Plugin Version and Builders

1.1.2, vsphere-iso

VMware vSphere Version

7.0U3

Simplified Packer Buildfile

 post-processor "vsphere" {
    cluster             = "${var.cluster}"
    datacenter          = "${var.datacenter}"
    datastore           = "${var.datastore}"
    disk_mode           = "thin"
    host                = "${var.vcenter_server}"
    insecure            = true
    overwrite           = true
    password            = "${var.password}"
    resource_pool       = "${var.resourcepool}"
    username            = "${var.username}"
    vm_folder           = "${var.folder}"
    vm_name             = "${local.vm_name}"
    vm_network          = "${var.final_network}"
  }

Log

==> vsphere-iso.vmware: Running post-processor:  (type vsphere)
    vsphere-iso.vmware (vsphere): Uploading output_vsphere/packer-debian-12-20230516-074107.ovf to vSphere
    vsphere-iso.vmware (vsphere): Validating Username and Password with dry-run
    vsphere-iso.vmware (vsphere): Calling OVFtool to upload vm
==> vsphere-iso.vmware (vsphere): /usr/bin/ovftool: line 10: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
    vsphere-iso.vmware (vsphere): Opening OVF source: output_vsphere/packer-debian-12-20230516-074107.ovf
    vsphere-iso.vmware (vsphere): The manifest validates
    vsphere-iso.vmware (vsphere): Opening VI target: vi://<redacted>
    vsphere-iso.vmware (vsphere): Deleting VM: packer-debian-12-20230516-074107
    vsphere-iso.vmware (vsphere): Deploying to VI: vi://<redacted>
    vsphere-iso.vmware (vsphere): Transfer Completed
    vsphere-iso.vmware (vsphere): Completed successfully
Build 'vsphere-iso.vmware' errored after 11 minutes 4 seconds: 1 error(s) occurred:
* Error destroying builder artifact: reading body msgpack decode error [pos 940]: reflect.Set: value of type map[interface {}]interface {} is not assignable to type error; bad artifact: []string(nil)
==> Wait completed after 11 minutes 4 seconds
==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.vmware: 1 error(s) occurred:
* Error destroying builder artifact: reading body msgpack decode error [pos 940]: reflect.Set: value of type map[interface {}]interface {} is not assignable to type error; bad artifact: []string(nil)
==> Builds finished but no artifacts were created.
@jaymzmac jaymzmac added the bug label May 16, 2023
@tenthirtyam tenthirtyam added the builder/vsphere-iso Builder: vsphere-iso label Jul 17, 2023
@tenthirtyam tenthirtyam changed the title vsphere-iso build fails trying to clean up artifact after running post-processor vsphere-iso: build fails trying to clean up artifact after running post-processor Jul 17, 2023
@tenthirtyam tenthirtyam self-assigned this Dec 6, 2023
@tenthirtyam tenthirtyam removed the builder/vsphere-iso Builder: vsphere-iso label Apr 19, 2024
@tenthirtyam tenthirtyam changed the title vsphere-iso: build fails trying to clean up artifact after running post-processor post-processor vsphere: fails to clean up artifact Apr 19, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Apr 25, 2024
@tenthirtyam
Copy link
Collaborator

tenthirtyam commented May 10, 2024

This appears to be coming from the Decode function imported from github.com/hashicorp/packer-plugin-sdk/template/config. While this is an upstream issue, this message may be able to be suppressed as it's not impacting the desired results.

I'll test my proposed changes and submit a pull request to address this one and link an upstream issue.

Update: After a couple hours of down the rabbithole I've not be able to track down the exact cause and either a fix or workaround. Might need to "phone a friend" @lbajolet-hashicorp for later assistance.

@tenthirtyam tenthirtyam modified the milestones: Backlog, On Deck May 10, 2024
@tenthirtyam tenthirtyam changed the title post-processor vsphere: fails to clean up artifact post-processor vsphere: "error destroying builder artifact" May 10, 2024
@tenthirtyam tenthirtyam removed their assignment May 10, 2024
@tenthirtyam tenthirtyam modified the milestones: On Deck, Backlog May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants