Skip to content

Implicit template name not used for overwriting artifacts #342

@adam-bishop

Description

@adam-bishop

Overview of the Issue

#93 added the capability to overwrite templates when -force is set.

This only works for explictly named templates however - if the default behaviour (the template being given the name of the source) is relied upon though, this step fails, as it tries to search with a template with an empty name:

==> proxmox-iso.rhel10-small: Force set, checking for existing artifact on PVE cluster
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 looking up VMs with name ''
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 >>>>>>>>>> REQUEST:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: GET /api2/json/cluster/resources?type=vm HTTP/1.1
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Host: 192.168.1.123:8006
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: User-Agent: Go-http-client/1.1
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Accept: application/json
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Authorization: PVEAPIToken=automation@pve!automation=388e84c2-160f-4107-a91f-ba99c096af9d
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Accept-Encoding: gzip
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 <<<<<<<<<< RESULT:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: HTTP/1.1 200 OK
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Content-Length: 1181
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Cache-Control: max-age=0
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Connection: Keep-Alive
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Content-Type: application/json;charset=UTF-8
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Date: Sun, 21 Dec 2025 17:23:53 GMT
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Expires: Sun, 21 Dec 2025 17:23:53 GMT
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Pragma: no-cache
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Server: pve-api-daemon/3.0
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: {"data":[{"mem":572456960,"maxdisk":34359738368,"netin":3125161066,"diskread":1382179696,"diskwrite":4370443776,"vmid":100,"maxcpu":2,"name":"test","id":"qemu/100","disk":0,"type":"qemu","status":"running","template":0,"memhost":999522304,"node":"pve-01","cpu":0.000996408533048005,"maxmem":4294967296,"uptime":2136805,"netout":51256626},{"maxdisk":34359738368,"netin":593001,"mem":859881472,"diskread":555722240,"diskwrite":14702592,"name":"test2","maxcpu":2,"vmid":101,"status":"running","template":0,"disk":0,"id":"qemu/101","type":"qemu","maxmem":2147483648,"cpu":0.000996408533048005,"node":"pve-01","memhost":859881472,"uptime":1370,"netout":101018},{"netout":0,"uptime":0,"maxmem":2147483648,"cpu":0,"memhost":0,"node":"pve-01","template":1,"status":"stopped","type":"qemu","id":"qemu/102","disk":0,"maxcpu":2,"diskwrite":0,"vmid":102,"name":"rhel10-small","diskread":0,"netin":0,"maxdisk":34359738368,"mem":0},{"diskread":0,"diskwrite":0,"maxcpu":2,"vmid":103,"name":"rhel10-small","maxdisk":34359738368,"netin":0,"mem":0,"uptime":0,"netout":0,"status":"stopped","template":1,"disk":0,"id":"qemu/103","type":"qemu","maxmem":2147483648,"cpu":0,"node":"pve-01","memhost":0}]}
==> proxmox-iso.rhel10-small: No existing artifact found

As this is so trivial to workaround (just set template_name - it's just an annoyance to set it to the same name as the source), I'm mostly logging this so it doesn't trip anyone else up. I may take a stab at fixing it myself too.

Reproduction Steps

Run packer with force, use the proxmox builder without a template_name set.

Plugin and Packer version

Packer v1.14.3

Simplified Packer Buildfile

Any packerfile will highlight the issue - just omit template_name and run with -force

Operating system and Environment details

MacOS client, Proxmox host.

Log Fragments and crash.log files

==> proxmox-iso.rhel10-small: Force set, checking for existing artifact on PVE cluster
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 looking up VMs with name ''
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 >>>>>>>>>> REQUEST:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: GET /api2/json/cluster/resources?type=vm HTTP/1.1
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Host: 192.168.1.123:8006
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: User-Agent: Go-http-client/1.1
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Accept: application/json
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Authorization: PVEAPIToken=automation@pve!automation=388e84c2-160f-4107-a91f-ba99c096af9d
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Accept-Encoding: gzip
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: 2025/12/21 17:23:53 <<<<<<<<<< RESULT:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: HTTP/1.1 200 OK
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Content-Length: 1181
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Cache-Control: max-age=0
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Connection: Keep-Alive
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Content-Type: application/json;charset=UTF-8
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Date: Sun, 21 Dec 2025 17:23:53 GMT
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Expires: Sun, 21 Dec 2025 17:23:53 GMT
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Pragma: no-cache
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: Server: pve-api-daemon/3.0
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin:
2025/12/21 17:23:53 packer-plugin-proxmox_v1.2.3_x5.0_darwin_arm64 plugin: {"data":[{"mem":572456960,"maxdisk":34359738368,"netin":3125161066,"diskread":1382179696,"diskwrite":4370443776,"vmid":100,"maxcpu":2,"name":"test","id":"qemu/100","disk":0,"type":"qemu","status":"running","template":0,"memhost":999522304,"node":"pve-01","cpu":0.000996408533048005,"maxmem":4294967296,"uptime":2136805,"netout":51256626},{"maxdisk":34359738368,"netin":593001,"mem":859881472,"diskread":555722240,"diskwrite":14702592,"name":"test2","maxcpu":2,"vmid":101,"status":"running","template":0,"disk":0,"id":"qemu/101","type":"qemu","maxmem":2147483648,"cpu":0.000996408533048005,"node":"pve-01","memhost":859881472,"uptime":1370,"netout":101018},{"netout":0,"uptime":0,"maxmem":2147483648,"cpu":0,"memhost":0,"node":"pve-01","template":1,"status":"stopped","type":"qemu","id":"qemu/102","disk":0,"maxcpu":2,"diskwrite":0,"vmid":102,"name":"rhel10-small","diskread":0,"netin":0,"maxdisk":34359738368,"mem":0},{"diskread":0,"diskwrite":0,"maxcpu":2,"vmid":103,"name":"rhel10-small","maxdisk":34359738368,"netin":0,"mem":0,"uptime":0,"netout":0,"status":"stopped","template":1,"disk":0,"id":"qemu/103","type":"qemu","maxmem":2147483648,"cpu":0,"node":"pve-01","memhost":0}]}
==> proxmox-iso.rhel10-small: No existing artifact found

(The token gets cycled on every build, so I've not scrubbed the logs, just in case anyone spots it 🙂).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions