[GH-ISSUE #212] Example Docs not working #121

Closed
opened 2026-02-27 15:46:32 +03:00 by kerem · 2 comments
Owner

Originally created by @YaBoiMax on GitHub (Jun 25, 2025).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/212

According to https://proxmoxer.github.io/docs/2.0/basic_usage/#dotted-notation I should be able to get a list of containers on all nodes like so:

>>> # get the list of all the nodes available from the connected node
>>> print(proxmox.nodes.get())
[{'type': 'node', 'node': 'example-node', 'ssl_fingerprint': '63:80:22:...:0D:12', 'id': 'node/example-node', 'status': 'unknown'}]
>>> # use the list of nodes to iterate through each and print the containers and their status
>>> for pve_node in proxmox.nodes.get():
...     print("{0}:".format(pve_node['node']))
...     for container in proxmox.nodes(pve_node['node']).lxc.get():
...         print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status']))
... 
example-node:
        100. container-a => running
        101. container-b => running
        105. container-c => running

However if I run

from proxmoxer import ProxmoxAPI
proxmox = ProxmoxAPI("proxmox.internal", port="443", user="root@pam", token_name="ansible", token_value="redacted", verify_ssl=True)

proxmox.nodes("node1").lxc.get()
for pve_node in proxmox.nodes.get():
  print("{0}:".format(pve_node['node']))
  for container in proxmox.nodes(pve_node['node']).lxc.get():
    print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status']))

I get

>>> from proxmoxer import ProxmoxAPI
>>> proxmox = ProxmoxAPI("proxmox.internal", port="443", user="root@pam", token_name="ansible", token_value="redacted", verify_ssl=True)
>>>
>>> proxmox.nodes("node1").lxc.get()
[]
>>> for pve_node in proxmox.nodes.get():
...   print("{0}:".format(pve_node['node']))
...   for container in proxmox.nodes(pve_node['node']).lxc.get():
...     print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status']))
...
node1:
node3:
node2:

Python3 Version:
Python 3.12.3
Proxmoxer Version:

>>> import proxmoxer
>>> print(proxmoxer.__version__)
2.0.1
Originally created by @YaBoiMax on GitHub (Jun 25, 2025). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/212 According to https://proxmoxer.github.io/docs/2.0/basic_usage/#dotted-notation I should be able to get a list of containers on all nodes like so: ``` >>> # get the list of all the nodes available from the connected node >>> print(proxmox.nodes.get()) [{'type': 'node', 'node': 'example-node', 'ssl_fingerprint': '63:80:22:...:0D:12', 'id': 'node/example-node', 'status': 'unknown'}] >>> # use the list of nodes to iterate through each and print the containers and their status >>> for pve_node in proxmox.nodes.get(): ... print("{0}:".format(pve_node['node'])) ... for container in proxmox.nodes(pve_node['node']).lxc.get(): ... print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status'])) ... example-node: 100. container-a => running 101. container-b => running 105. container-c => running ``` However if I run ``` from proxmoxer import ProxmoxAPI proxmox = ProxmoxAPI("proxmox.internal", port="443", user="root@pam", token_name="ansible", token_value="redacted", verify_ssl=True) proxmox.nodes("node1").lxc.get() for pve_node in proxmox.nodes.get(): print("{0}:".format(pve_node['node'])) for container in proxmox.nodes(pve_node['node']).lxc.get(): print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status'])) ``` I get ``` >>> from proxmoxer import ProxmoxAPI >>> proxmox = ProxmoxAPI("proxmox.internal", port="443", user="root@pam", token_name="ansible", token_value="redacted", verify_ssl=True) >>> >>> proxmox.nodes("node1").lxc.get() [] >>> for pve_node in proxmox.nodes.get(): ... print("{0}:".format(pve_node['node'])) ... for container in proxmox.nodes(pve_node['node']).lxc.get(): ... print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status'])) ... node1: node3: node2: ``` Python3 Version: `Python 3.12.3` Proxmoxer Version: ``` >>> import proxmoxer >>> print(proxmoxer.__version__) 2.0.1 ```
kerem closed this issue 2026-02-27 15:46:32 +03:00
Author
Owner

@YaBoiMax commented on GitHub (Jun 25, 2025):

Upon further testing, using the paramiko backend, it works without error

>>> from proxmoxer import ProxmoxAPI
>>> proxmox = ProxmoxAPI('proxmox.internal', user='root', private_key_file='/root/.ssh/id_rsa', backend='ssh_paramiko')
>>>
>>> for pve_node in proxmox.nodes.get():
...   print("{0}:".format(pve_node['node']))
...   for container in proxmox.nodes(pve_node['node']).lxc.get():
...     print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status']))
...
node2:
	127. redacted => running
	123. redacted => running
	132. redacted => running
	147. redacted => stopped
	116. redacted => running
	118. redacted => running
	108. redacted => running
	129. redacted => running
	110. redacted => stopped
	120. redacted => running
	152. redacted => running
	126. redacted => running
node3:
node1:
	111. redacted => running
	122. redacted => running
	119. redacted => running
	121. redacted => running
	130. redacted => running
	114. redacted => running
	102. redacted => running
	128. redacted => stopped
	125. redacted => running
	141. redacted => stopped
	124. redacted => running
	131. redacted => running
<!-- gh-comment-id:3004052469 --> @YaBoiMax commented on GitHub (Jun 25, 2025): Upon further testing, using the paramiko backend, it works without error ``` >>> from proxmoxer import ProxmoxAPI >>> proxmox = ProxmoxAPI('proxmox.internal', user='root', private_key_file='/root/.ssh/id_rsa', backend='ssh_paramiko') >>> >>> for pve_node in proxmox.nodes.get(): ... print("{0}:".format(pve_node['node'])) ... for container in proxmox.nodes(pve_node['node']).lxc.get(): ... print("\t{0}. {1} => {2}".format(container['vmid'], container['name'], container['status'])) ... node2: 127. redacted => running 123. redacted => running 132. redacted => running 147. redacted => stopped 116. redacted => running 118. redacted => running 108. redacted => running 129. redacted => running 110. redacted => stopped 120. redacted => running 152. redacted => running 126. redacted => running node3: node1: 111. redacted => running 122. redacted => running 119. redacted => running 121. redacted => running 130. redacted => running 114. redacted => running 102. redacted => running 128. redacted => stopped 125. redacted => running 141. redacted => stopped 124. redacted => running 131. redacted => running ```
Author
Owner

@YaBoiMax commented on GitHub (Jun 25, 2025):

Upon even further testing it seems I oversaw that my API key had Privilege Separation enabled and I had no ACLs for it configured. Disabling the Privilege Separation or setting proper ACLs fixes the issue.

<!-- gh-comment-id:3004484140 --> @YaBoiMax commented on GitHub (Jun 25, 2025): Upon even further testing it seems I oversaw that my API key had Privilege Separation enabled and I had no ACLs for it configured. Disabling the Privilege Separation or setting proper ACLs fixes the issue.
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#121
No description provided.