[GH-ISSUE #117] returning invalid task ID from VM start command #62

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

Originally created by @vakabus on GitHub (Nov 3, 2022).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/117

Hi, I've found a weird behavior which I am assuming is a bug. I am not sure if it's related to the library or Proxmox API itself, I am posting it just here for now.

What happens

When I run:

from proxmoxer import ProxmoxAPI
proxmox = ProxmoxAPI("tapir.lan", user="root", backend="openssh", service="pve")
proxmox.nodes("tapir").qemu(500).status.start.post()

the return value of the last command is:

{'errors': b'generating cloud-init ISO\n"UPID:tapir:00128784:028D7FB7:6363E6E9:qmstart:500:root@pam:"'}

What I would expect

I would expect just the string UPID:tapir:00128784:028D7FB7:6363E6E9:qmstart:500:root@pam: being returned.

Originally created by @vakabus on GitHub (Nov 3, 2022). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/117 Hi, I've found a weird behavior which I am assuming is a bug. I am not sure if it's related to the library or Proxmox API itself, I am posting it just here for now. ### What happens When I run: ```python from proxmoxer import ProxmoxAPI proxmox = ProxmoxAPI("tapir.lan", user="root", backend="openssh", service="pve") proxmox.nodes("tapir").qemu(500).status.start.post() ``` the return value of the last command is: ```python {'errors': b'generating cloud-init ISO\n"UPID:tapir:00128784:028D7FB7:6363E6E9:qmstart:500:root@pam:"'} ``` ### What I would expect I would expect just the string `UPID:tapir:00128784:028D7FB7:6363E6E9:qmstart:500:root@pam:` being returned.
Author
Owner

@jhollowe commented on GitHub (Nov 3, 2022):

I'm 99% sure this is an issue with PVE, but just to check can you try the same thing with the https backend? This might be an issue where the CLI for the API (which is what the openssh backend uses) prints extra information when using cloud-init.

<!-- gh-comment-id:1302366763 --> @jhollowe commented on GitHub (Nov 3, 2022): I'm 99% sure this is an issue with PVE, but just to check can you try the same thing with the `https` backend? This might be an issue where the CLI for the API (which is what the `openssh` backend uses) prints extra information when using cloud-init.
Author
Owner

@vakabus commented on GitHub (Nov 3, 2022):

I can confirm that with the https backend it works as expected and only the task id is returned.

<!-- gh-comment-id:1302380405 --> @vakabus commented on GitHub (Nov 3, 2022): I can confirm that with the `https` backend it works as expected and only the task id is returned.
Author
Owner

@jhollowe commented on GitHub (Nov 3, 2022):

yeah, than this is a Proxmox issue. You can ask about the issue on the official forums or just directly file a PVE bug

<!-- gh-comment-id:1302442600 --> @jhollowe commented on GitHub (Nov 3, 2022): yeah, than this is a Proxmox issue. You can ask about the issue on the [official forums](https://forum.proxmox.com/) or just directly [file a PVE bug](https://bugzilla.proxmox.com/)
Author
Owner

@BioSehnsucht commented on GitHub (Nov 28, 2022):

This issue also occurs in local mode (which is more or less SSH backend without the SSH).

I guess Proxmox shouldn't return an informative message as an error, so it really is a Proxmox issue, but the VM does actually start without any issues as far as I can tell, so of course, that's confusing.

For reference, I see that this has been reported to Proxmox : https://bugzilla.proxmox.com/show_bug.cgi?id=4333

Seems to be messages are being output to STDOUT rather than STDERR or added to the JSON properly.

<!-- gh-comment-id:1328554395 --> @BioSehnsucht commented on GitHub (Nov 28, 2022): This issue also occurs in local mode (which is more or less SSH backend without the SSH). I guess Proxmox shouldn't return an informative message as an error, so it really is a Proxmox issue, but the VM does actually start without any issues as far as I can tell, so of course, that's confusing. For reference, I see that this has been reported to Proxmox : https://bugzilla.proxmox.com/show_bug.cgi?id=4333 Seems to be messages are being output to STDOUT rather than STDERR or added to the JSON properly.
Author
Owner

@reitermarkus commented on GitHub (Nov 28, 2022):

I guess Proxmox shouldn't return an informative message as an error

To be clear, Proxmox outputs the message to STDOUT, which leads to Proxmoxer trying to parse both the message line and the following JSON line as JSON.

While this is of course a Proxmox issue, and has already reported, it would still make sense in my opinion to work around it in Proxmoxer until an official fix has been released, since as least Proxmox 7.2 and 7.3 are affected by this now.

As far as I can tell, it should be as simple as trying parsing only the last line as JSON if parsing fails the first time on the affected Proxmox versions. Basically what I did at https://github.com/ansible-collections/community.general/pull/4027/files#diff-e0436e452ddd5c8a44426d18198373fd4f991b98348e497741e111495defaf47R1023-R1025, but more generally applied to all Proxmoxer calls.

<!-- gh-comment-id:1329343479 --> @reitermarkus commented on GitHub (Nov 28, 2022): > I guess Proxmox shouldn't return an informative message as an error To be clear, Proxmox outputs the message to STDOUT, which leads to Proxmoxer trying to parse both the message line and the following JSON line as JSON. While this is of course a Proxmox issue, and has already reported, it would still make sense in my opinion to work around it in Proxmoxer until an official fix has been released, since as least Proxmox 7.2 and 7.3 are affected by this now. As far as I can tell, it should be as simple as trying parsing only the last line as JSON if parsing fails the first time on the affected Proxmox versions. Basically what I did at https://github.com/ansible-collections/community.general/pull/4027/files#diff-e0436e452ddd5c8a44426d18198373fd4f991b98348e497741e111495defaf47R1023-R1025, but more generally applied to all Proxmoxer calls.
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#62
No description provided.