[GH-ISSUE #74] Proxmoxer syntax is broken with Proxmox API v7.0 #40

Closed
opened 2026-02-27 15:46:08 +03:00 by kerem · 1 comment
Owner

Originally created by @nzlosh on GitHub (Nov 12, 2021).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/74

According to the proxmoxer documentation the following forms are equivalent:

proxmox.nodes(node['node']).openvz.get()
proxmox.nodes(node['node']).get('openvz')
proxmox.get('nodes/%s/openvz' % node['node'])
proxmox.get('nodes', node['node'], 'openvz')

From what I can tell from the Proxmox v7.0 API documentation, openvz was replaced by qemu.
Applying the same syntax patterns but replacing openvz with qemu, proxmoxer only partially functions:

>>> node_id = proxmox.nodes.get()[0]["node"]
>>> node_id
'n1-cls1'
>>> proxmox.nodes(node_id).qemu.get()
[{'maxmem': 2147483648, 'vmid': 100, 'netout': 0, 'uptime': 0, 'template': 1, 'cpu': 0, 'diskread': 0, 'name': 'vm1', 'cpus': 1, 'netin': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'status': 'stopped', 'mem': 0, 'disk': 0}, {'cpus': 1, 'name': 'vm2', 'diskread': 0, 'maxmem': 2147483648, 'vmid': 102, 'uptime': 0, 'cpu': 0, 'netout': 0, 'mem': 0, 'status': 'stopped', 'disk': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0}, {'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'disk': 0, 'status': 'stopped', 'mem': 0, 'netout': 0, 'uptime': 0, 'cpu': 0, 'vmid': 104, 'maxmem': 2147483648, 'name': 'vm3', 'diskread': 0, 'cpus': 1}, {'disk': 0, 'mem': 0, 'status': 'stopped', 'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'cpus': 1, 'name': 'vm4', 'diskread': 0, 'uptime': 0, 'cpu': 0, 'netout': 0, 'vmid': 101, 'maxmem': 2147483648}, {'disk': 0, 'status': 'stopped', 'mem': 0, 'netin': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'diskread': 0, 'name': 'vm5', 'cpus': 1, 'netout': 0, 'cpu': 0, 'uptime': 0, 'vmid': 103, 'maxmem': 2147483648}]
>>> proxmox.nodes(node_id).get('qemu')
[{'uptime': 0, 'template': 1, 'cpu': 0, 'netout': 0, 'vmid': 100, 'maxmem': 2147483648, 'cpus': 1, 'name': 'vm1', 'diskread': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'disk': 0, 'mem': 0, 'status': 'stopped'}, {'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'status': 'stopped', 'mem': 0, 'disk': 0, 'vmid': 102, 'maxmem': 2147483648, 'netout': 0, 'cpu': 0, 'uptime': 0, 'name': 'vm2', 'diskread': 0, 'cpus': 1}, {'cpus': 1, 'name': 'vm3', 'diskread': 0, 'maxmem': 2147483648, 'vmid': 104, 'cpu': 0, 'uptime': 0, 'netout': 0, 'mem': 0, 'status': 'stopped', 'disk': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0}, {'cpu': 0, 'uptime': 0, 'netout': 0, 'maxmem': 2147483648, 'vmid': 103, 'cpus': 1, 'name': 'vm4', 'diskread': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0, 'disk': 0, 'mem': 0, 'status': 'stopped'}, {'netout': 0, 'uptime': 0, 'cpu': 0, 'maxmem': 2147483648, 'vmid': 101, 'name': 'vm5', 'diskread': 0, 'cpus': 1, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0, 'disk': 0, 'status': 'stopped', 'mem': 0}]
>>> proxmox.get('nodes/%s/qemu' % node_id)
<proxmoxer.core.ProxmoxResource object at 0x7fef2e04cf50>
>>> proxmox.get('nodes', node_id, 'qemu')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __call__() takes from 1 to 2 positional arguments but 4 were given

My use case: Automatically generate code snippets based on the API documentation. The API documentation provides the http verb and path to call which translates perfectly to proxmoxer's path string syntax, which leads to the problem raised in this issue.

Should the path syntax function or has it been deprecated/removed on purpose?

Originally created by @nzlosh on GitHub (Nov 12, 2021). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/74 According to the proxmoxer documentation the following forms are equivalent: ``` proxmox.nodes(node['node']).openvz.get() proxmox.nodes(node['node']).get('openvz') proxmox.get('nodes/%s/openvz' % node['node']) proxmox.get('nodes', node['node'], 'openvz') ``` From what I can tell from the Proxmox v7.0 API documentation, `openvz` was replaced by `qemu`. Applying the same syntax patterns but replacing `openvz` with `qemu`, proxmoxer only partially functions: ``` >>> node_id = proxmox.nodes.get()[0]["node"] >>> node_id 'n1-cls1' >>> proxmox.nodes(node_id).qemu.get() [{'maxmem': 2147483648, 'vmid': 100, 'netout': 0, 'uptime': 0, 'template': 1, 'cpu': 0, 'diskread': 0, 'name': 'vm1', 'cpus': 1, 'netin': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'status': 'stopped', 'mem': 0, 'disk': 0}, {'cpus': 1, 'name': 'vm2', 'diskread': 0, 'maxmem': 2147483648, 'vmid': 102, 'uptime': 0, 'cpu': 0, 'netout': 0, 'mem': 0, 'status': 'stopped', 'disk': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0}, {'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'disk': 0, 'status': 'stopped', 'mem': 0, 'netout': 0, 'uptime': 0, 'cpu': 0, 'vmid': 104, 'maxmem': 2147483648, 'name': 'vm3', 'diskread': 0, 'cpus': 1}, {'disk': 0, 'mem': 0, 'status': 'stopped', 'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'cpus': 1, 'name': 'vm4', 'diskread': 0, 'uptime': 0, 'cpu': 0, 'netout': 0, 'vmid': 101, 'maxmem': 2147483648}, {'disk': 0, 'status': 'stopped', 'mem': 0, 'netin': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'diskread': 0, 'name': 'vm5', 'cpus': 1, 'netout': 0, 'cpu': 0, 'uptime': 0, 'vmid': 103, 'maxmem': 2147483648}] >>> proxmox.nodes(node_id).get('qemu') [{'uptime': 0, 'template': 1, 'cpu': 0, 'netout': 0, 'vmid': 100, 'maxmem': 2147483648, 'cpus': 1, 'name': 'vm1', 'diskread': 0, 'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'disk': 0, 'mem': 0, 'status': 'stopped'}, {'maxdisk': 10737418240, 'diskwrite': 0, 'netin': 0, 'status': 'stopped', 'mem': 0, 'disk': 0, 'vmid': 102, 'maxmem': 2147483648, 'netout': 0, 'cpu': 0, 'uptime': 0, 'name': 'vm2', 'diskread': 0, 'cpus': 1}, {'cpus': 1, 'name': 'vm3', 'diskread': 0, 'maxmem': 2147483648, 'vmid': 104, 'cpu': 0, 'uptime': 0, 'netout': 0, 'mem': 0, 'status': 'stopped', 'disk': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0}, {'cpu': 0, 'uptime': 0, 'netout': 0, 'maxmem': 2147483648, 'vmid': 103, 'cpus': 1, 'name': 'vm4', 'diskread': 0, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0, 'disk': 0, 'mem': 0, 'status': 'stopped'}, {'netout': 0, 'uptime': 0, 'cpu': 0, 'maxmem': 2147483648, 'vmid': 101, 'name': 'vm5', 'diskread': 0, 'cpus': 1, 'diskwrite': 0, 'maxdisk': 10737418240, 'netin': 0, 'disk': 0, 'status': 'stopped', 'mem': 0}] >>> proxmox.get('nodes/%s/qemu' % node_id) <proxmoxer.core.ProxmoxResource object at 0x7fef2e04cf50> >>> proxmox.get('nodes', node_id, 'qemu') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __call__() takes from 1 to 2 positional arguments but 4 were given ``` My use case: Automatically generate code snippets based on the API documentation. The API documentation provides the http verb and path to call which translates perfectly to proxmoxer's path string syntax, which leads to the problem raised in this issue. Should the path syntax function or has it been deprecated/removed on purpose?
kerem 2026-02-27 15:46:08 +03:00
Author
Owner

@nzlosh commented on GitHub (Nov 12, 2021):

I just realised my dev environment was running an old version (1.0.3) of proxmoxer. After upgrading to version 1.2.0, both syntaxes function perfectly. Sorry for the noise.

<!-- gh-comment-id:967000421 --> @nzlosh commented on GitHub (Nov 12, 2021): I just realised my dev environment was running an old version (1.0.3) of proxmoxer. After upgrading to version 1.2.0, both syntaxes function perfectly. Sorry for the noise.
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/proxmoxer#40
No description provided.