[GH-ISSUE #260] Cannot convert LXC to template: POST /nodes/{node}/lxc/{id}/template #57

Closed
opened 2026-02-28 00:40:23 +03:00 by kerem · 0 comments
Owner

Originally created by @chrisbenincasa on GitHub (May 11, 2023).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/260

The code for creating a template from a VmRef expects the API response to contain a Task ID it can wait on: https://github.com/Telmate/proxmox-api-go/blob/master/proxmox/client.go#L373-L381

However, a Task ID is only returned in the QEMU VM case: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/template

When converting an LXC to a template, the response contains simply: {data: null}: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/template

The client then returns an error:

Can't convert Vm to template:

Example request and response, outputted before erroneously failing

2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 >>>>>>>>>> REQUEST:
2023/05/11 13:59:01 packer-plugin-proxmox plugin: POST /api2/json/nodes/zeus/lxc/103/template HTTP/1.1
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Host: REDACTED
2023/05/11 13:59:01 packer-plugin-proxmox plugin: User-Agent: Go-http-client/1.1
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Length: 0
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Accept: application/json
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Authorization: PVEAPIToken=terraform@pve!terraform=REDACTED
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Type: application/x-www-form-urlencoded
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Accept-Encoding: gzip
2023/05/11 13:59:01 packer-plugin-proxmox plugin:
2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 <<<<<<<<<< RESULT:
2023/05/11 13:59:01 packer-plugin-proxmox plugin: HTTP/1.1 200 OK
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Length: 13
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Alt-Svc: h3=":443"; ma=2592000
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Cache-Control: max-age=0
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Type: application/json;charset=UTF-8
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Date: Thu, 11 May 2023 17:59:01 GMT
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Expires: Thu, 11 May 2023 17:59:01 GMT
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Pragma: no-cache
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Server: Caddy
2023/05/11 13:59:01 packer-plugin-proxmox plugin: Server: pve-api-daemon/3.0
2023/05/11 13:59:01 packer-plugin-proxmox plugin:
2023/05/11 13:59:01 packer-plugin-proxmox plugin: {"data":null}
Originally created by @chrisbenincasa on GitHub (May 11, 2023). Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/260 The code for creating a template from a VmRef expects the API response to contain a Task ID it can wait on: https://github.com/Telmate/proxmox-api-go/blob/master/proxmox/client.go#L373-L381 However, a Task ID is only returned in the QEMU VM case: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/template When converting an LXC to a template, the response contains simply: `{data: null}`: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/template The client then returns an error: ``` Can't convert Vm to template: ``` Example request and response, outputted before erroneously failing ``` 2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 >>>>>>>>>> REQUEST: 2023/05/11 13:59:01 packer-plugin-proxmox plugin: POST /api2/json/nodes/zeus/lxc/103/template HTTP/1.1 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Host: REDACTED 2023/05/11 13:59:01 packer-plugin-proxmox plugin: User-Agent: Go-http-client/1.1 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Length: 0 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Accept: application/json 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Authorization: PVEAPIToken=terraform@pve!terraform=REDACTED 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Type: application/x-www-form-urlencoded 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Accept-Encoding: gzip 2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 <<<<<<<<<< RESULT: 2023/05/11 13:59:01 packer-plugin-proxmox plugin: HTTP/1.1 200 OK 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Length: 13 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Alt-Svc: h3=":443"; ma=2592000 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Cache-Control: max-age=0 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Content-Type: application/json;charset=UTF-8 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Date: Thu, 11 May 2023 17:59:01 GMT 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Expires: Thu, 11 May 2023 17:59:01 GMT 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Pragma: no-cache 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Server: Caddy 2023/05/11 13:59:01 packer-plugin-proxmox plugin: Server: pve-api-daemon/3.0 2023/05/11 13:59:01 packer-plugin-proxmox plugin: 2023/05/11 13:59:01 packer-plugin-proxmox plugin: {"data":null} ```
kerem closed this issue 2026-02-28 00:40:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#57
No description provided.