[GH-ISSUE #42] PBS Support #21

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

Originally created by @tuxis-ie on GitHub (Dec 4, 2020).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/42

Is anyone working on PBS support already?

Originally created by @tuxis-ie on GitHub (Dec 4, 2020). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/42 Is anyone working on PBS support already?
Author
Owner

@jhollowe commented on GitHub (Dec 4, 2020):

Is there official API documentation for PBS? I looked a little while ago and didn't find anything. It should be super easy to add support if it follows the same basic API spec for auth and stuff.

<!-- gh-comment-id:739049241 --> @jhollowe commented on GitHub (Dec 4, 2020): Is there official API documentation for PBS? I looked a little while ago and didn't find anything. It *should* be super easy to add support if it follows the same basic API spec for auth and stuff.
Author
Owner

@tuxis-ie commented on GitHub (Dec 5, 2020):

No, not yet.

Some testing by me shows that for https-as-a-user, the otp-json part is not supposed to be sent. The authentication-header is called PBS-etc instead of PVE-etc, but I did not manage to get that working (although I'm not sure if I understand the proxmoxer-code enough :))

<!-- gh-comment-id:739322746 --> @tuxis-ie commented on GitHub (Dec 5, 2020): No, not yet. Some testing by me shows that for https-as-a-user, the otp-json part is not supposed to be sent. The authentication-header is called PBS-etc instead of PVE-etc, but I did not manage to get that working (although I'm not sure if I understand the proxmoxer-code enough :))
Author
Owner

@jhollowe commented on GitHub (Dec 20, 2020):

As long as it uses some of the same authentication and layout methods (which from looking into the PBS integrations into the other Proxmox services looks likely), it should be incredibly easy to add PBS support. #34 should make it so we can just add "PBS" to SUPPORTED_SERVICES and it should just work. We will of course need to do testing to ensure what parts are and are not compatible.

<!-- gh-comment-id:748631840 --> @jhollowe commented on GitHub (Dec 20, 2020): As long as it uses some of the same authentication and layout methods (which from looking into the PBS integrations into the other Proxmox services looks likely), it should be incredibly easy to add PBS support. #34 should make it so we can just add "PBS" to `SUPPORTED_SERVICES` and it should just work. We will of course need to do testing to ensure what parts are and are not compatible.
Author
Owner

@jhollowe commented on GitHub (Dec 20, 2020):

Just found more info as well confirming API Token support in PBS: https://pbs.proxmox.com/docs/user-management.html#api-tokens

<!-- gh-comment-id:748632064 --> @jhollowe commented on GitHub (Dec 20, 2020): Just found more info as well confirming API Token support in PBS: https://pbs.proxmox.com/docs/user-management.html#api-tokens
Author
Owner

@jhollowe commented on GitHub (Dec 20, 2020):

It looks like there are a few things not working yet (waiting on a response about API Tokens), but basic HTTPS username/password auth and standard queries seem to be working by adding "PBS" to SUPPORTED_SERVICES in core.py in the develop branch.

<!-- gh-comment-id:748673193 --> @jhollowe commented on GitHub (Dec 20, 2020): It looks like there are a few things not working yet ([waiting on a response about API Tokens](https://forum.proxmox.com/threads/api-token-problems.81020/)), but basic HTTPS username/password auth and standard queries seem to be working by adding "PBS" to `SUPPORTED_SERVICES` in `core.py` in the develop branch.
Author
Owner

@jhollowe commented on GitHub (May 20, 2021):

@tuxis-ie Can you try running the code in #43 and report back if it works as expected?

You can clone the PR branch, and in its directory run pip install . to use the branch as the installed version of proxmoxer. You can then import proxmoxer as normal and test its functionality with PBS.

<!-- gh-comment-id:844695424 --> @jhollowe commented on GitHub (May 20, 2021): @tuxis-ie Can you try running the code in #43 and report back if it works as expected? You can clone [the PR branch](https://github.com/jhollowe/proxmoxer/tree/service-generalize), and in its directory run `pip install .` to use the branch as the installed version of proxmoxer. You can then import proxmoxer as normal and test its functionality with PBS.
Author
Owner

@wmorgue commented on GitHub (May 21, 2021):

Hi @jhollowe and thank you for the good work 👍🏻

I tested some API calls with service-generalize branch. The screenshot below shows which methods work or don't work.

Screen Shot 2021-05-21 at 14 35 59

{'pong': True}
[{'comment': 'Linux PAM standard authentication', 'default': True, 'realm': 'pam'}, {'comment': 'Proxmox Backup authentication server', 'realm': 'pbs'}]
Method's below ⬇ doesn't working with same error: 

Traceback (most recent call last):
  File "/Users/moon/Developer/Work/pbs_api/src/main.py", line 37, in <module>
    print(proxmox.version.get())
  File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/proxmoxer/core.py", line 155, in get
    return self(args)._request("GET", params=params)
  File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/proxmoxer/core.py", line 123, in _request
    if resp.json().get("errors") != None:
  File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The other methods fall with the same error. Python 3.9.5.

PBS Version API — https://pbs.proxmox.com/docs/api-viewer/index.html#/version

<!-- gh-comment-id:845891730 --> @wmorgue commented on GitHub (May 21, 2021): Hi @jhollowe and thank you for the good work 👍🏻 I tested some API calls with `service-generalize` branch. The screenshot below shows which methods work or don't work. ![Screen Shot 2021-05-21 at 14 35 59](https://user-images.githubusercontent.com/24982084/119131441-28cc0800-ba42-11eb-8de2-1b598ffe750f.png) ```python {'pong': True} [{'comment': 'Linux PAM standard authentication', 'default': True, 'realm': 'pam'}, {'comment': 'Proxmox Backup authentication server', 'realm': 'pbs'}] Method's below ⬇ doesn't working with same error: Traceback (most recent call last): File "/Users/moon/Developer/Work/pbs_api/src/main.py", line 37, in <module> print(proxmox.version.get()) File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/proxmoxer/core.py", line 155, in get return self(args)._request("GET", params=params) File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/proxmoxer/core.py", line 123, in _request if resp.json().get("errors") != None: File "/Users/moon/.local/share/virtualenvs/pbs_api-zUSF1Mt6/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ``` The other methods fall with the same error. Python 3.9.5. PBS Version API — https://pbs.proxmox.com/docs/api-viewer/index.html#/version
Author
Owner

@jhollowe commented on GitHub (May 22, 2021):

hrm, using PBS 1.1-1, I get the following:

>>> pbs = ProxmoxAPI('1.2.3.4', user='root@pam', password='password', verify_ssl=False, service='pbs')
>>> pbs.version.get()
{'release': '1', 'repoid': '', 'version': '1.1'}

Can you confirm that the API is returning JSON for the version endpoint? if you log into PBS in your browser and then go to https://<your_ip>:8007/api2/json/version, what is the text that appears?

<!-- gh-comment-id:846367254 --> @jhollowe commented on GitHub (May 22, 2021): hrm, using PBS 1.1-1, I get the following: ``` >>> pbs = ProxmoxAPI('1.2.3.4', user='root@pam', password='password', verify_ssl=False, service='pbs') >>> pbs.version.get() {'release': '1', 'repoid': '', 'version': '1.1'} ``` Can you confirm that the API is returning JSON for the version endpoint? if you log into PBS in your browser and then go to `https://<your_ip>:8007/api2/json/version`, what is the text that appears?
Author
Owner

@wmorgue commented on GitHub (May 22, 2021):

@jhollowe damn, i forgot write service="PBS" into ProxmoxAPI class 😅
Works without errors. Yep, also web JSON works or 127.0.0.1:82/api2/json/version.

Thank you 👍🏻

<!-- gh-comment-id:846380147 --> @wmorgue commented on GitHub (May 22, 2021): @jhollowe damn, i forgot write `service="PBS"` into `ProxmoxAPI` class 😅 Works without errors. Yep, also web JSON works or `127.0.0.1:82/api2/json/version`. Thank you 👍🏻
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#21
No description provided.