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

vsphere-iso: unable to overwrite ISO in packer_cache even though checksum has changed #55

Closed
ghost opened this issue Apr 22, 2021 · 1 comment · Fixed by #399
Closed
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Apr 22, 2021

This issue was originally opened by @ryan-jan as hashicorp/packer#10809. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Apologies in advance if I am misunderstanding how this is supposed to work. I am using the vsphere-iso builder and am specifying an ISO and checksum file as follows.

  iso_url = "file:/E:\\WindowsServer-2019\\WindowsServer-2019.iso"
  iso_checksum = "file:E:\\WindowsServer-2019\\WindowsServer-2019.iso.sum"

This WindowsServer-2019.iso is created via a script which integrates the latest updates into the ISO before then kicking off my packer build using the generated ISO. However, packer is not uploading the ISO to the packer_cache directory as there is already an ISO of the same name in the directory (the ISO I created last month with last months updates).

==> vsphere-iso.msftserver2019std: Trying file://E:/WindowsServer-2019/WindowsServer-2019.iso?checksum=sha1%3Ac52a8e7b050a939d8e5669f7e3c2170369524b9b

==> vsphere-iso.msftserver2019std: file://E:/WindowsServer-2019/WindowsServer-2019.iso?checksum=sha1%3Ac52a8e7b050a939d8e5669f7e3c2170369524b9b => E:/WindowsServer-2019/WindowsServer-2019.iso

==> vsphere-iso.msftserver2019std: File [DATASTORE1] packer_cache//WindowsServer-2019.iso already exists; skipping upload.

I had assumed that because the checksum no longer matches the file in the packer_cache directory that packer would upload my new ISO file and overwrite the previous one. Is this not how this should work? If not, how should I deal with this situation where each month I want to overwrite the ISO in the cache with a new one?

Packer version

From 1.7.0

Operating system and Environment details

Packer is running on a Windows Server 2019 (1809) virtual machine.

@jpbuecken
Copy link

I'm not sure if it is difficult to get the md5 of a iso that resist in vsphere. For me, a "force" switch would be sufficient. (Upload the iso even if it is already present with that name), e.g.

         "iso_url":                   "http://....autoyast.iso",
         "iso_checksum":              "file:http://.....autoyast.iso.md5",
         "iso_target_path":           "/tmp/packer_cache/autoyast.iso",
         "iso_replace_remote_cache": true                   # force replace iso in vsphere datastore
         "iso_replace_target_path": true                       # force replace iso in local packer cache directory

The suggestion of iso_replace_target_path is not important, I can run a cleanup-provisioner with a local exec provisioner that will delete the file.

In the meantime any idea how I can use the packer authentication to vpshere in a local exec provisioner would be great as well,
e.g.

      {
         "type": "shell-local",
         "command": "curl -X GET https://{{user `os_vcenter_server`}}/api/session -H 'vmware-api-session-id: ???????' -H 'Content-type: application/json' "
      },

hmalphettes pushed a commit to hmalphettes/packer-plugin-vsphere that referenced this issue May 7, 2022
@tenthirtyam tenthirtyam changed the title vsphere-iso builder - unable to overwrite ISO in packer_cache even though checksum has changed vsphere-iso: unable to overwrite ISO in packer_cache even though checksum has changed Nov 4, 2022
@tenthirtyam tenthirtyam self-assigned this Mar 5, 2024
@tenthirtyam tenthirtyam added this to the v1.2.7 milestone Apr 2, 2024
@tenthirtyam tenthirtyam removed this from the v1.2.7 milestone Apr 5, 2024
@hashicorp hashicorp locked and limited conversation to collaborators Jun 29, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants