[GH-ISSUE #62] proxmoxer variables inside .post(variable=array) error #30

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

Originally created by @enimath on GitHub (Jun 15, 2021).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/62

Hello,

I want to send post method via proxmoxer but I want to use variables "hdd3_type" instead of scsi2 (when I put scsi2=hdd3array it is working!) :

code :

def vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array):
  hddadd = proxmox.nodes(targetnode).qemu(vm_modifyid).config.post(hdd3_type=hdd3array)
  return hddadd

hdd3_type = 'scsi2'
hdd3array = 'moosefs:3,format=qcow2,discard=on'
upid = vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array)

return
parameter verification failed. - b'{"data":null,"errors":{"hdd3_type":"property is not defined in schema and the schema does not allow additional properties"}}'

I was checking also some other methods to omit this error but without success.
.post(hdd3_type+'='+hdd3array)

return
Not Implemented: Method 'POST /nodes/local-15/qemu/100/config/scsi2=moosefs:3,format=qcow2,discard=on' not implemented - b'{"data":null}'

Originally created by @enimath on GitHub (Jun 15, 2021). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/62 Hello, I want to send post method via proxmoxer but I want to use variables "hdd3_type" instead of scsi2 (when I put scsi2=hdd3array it is working!) : code : ```python def vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array): hddadd = proxmox.nodes(targetnode).qemu(vm_modifyid).config.post(hdd3_type=hdd3array) return hddadd hdd3_type = 'scsi2' hdd3array = 'moosefs:3,format=qcow2,discard=on' upid = vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array) ``` return `parameter verification failed. - b'{"data":null,"errors":{"hdd3_type":"property is not defined in schema and the schema does not allow additional properties"}}'` I was checking also some other methods to omit this error but without success. `.post(hdd3_type+'='+hdd3array)` return `Not Implemented: Method 'POST /nodes/local-15/qemu/100/config/scsi2=moosefs:3,format=qcow2,discard=on' not implemented - b'{"data":null}'`
kerem 2026-02-27 15:46:03 +03:00
Author
Owner

@jhollowe commented on GitHub (Jun 25, 2021):

Python sees hdd3_type and doesn't think it is a variable, but simply a name of an argument to the post() function. You need to change the actual name of the argument using the contents of the hdd3_type variable. An easy way to do this is by setting up a dict with your data and then unpack that dict as the arguments to the post

def vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array):
  params[hdd3_type] = hdd3array
  hddadd = proxmox.nodes(targetnode).qemu(vm_modifyid).config.post(**params)
  return hddadd

Feel free to close the issue if this works or comment back with any further errors!

(I didn't test this, but it should work)

<!-- gh-comment-id:868149967 --> @jhollowe commented on GitHub (Jun 25, 2021): Python sees `hdd3_type` and doesn't think it is a variable, but simply a name of an argument to the `post()` function. You need to change the actual name of the argument using the contents of the `hdd3_type` variable. An easy way to do this is by setting up a dict with your data and then unpack that dict as the arguments to the post ```python def vm_hdd_add(targetnode,vm_modifyid,hdd3_type,hdd3array): params[hdd3_type] = hdd3array hddadd = proxmox.nodes(targetnode).qemu(vm_modifyid).config.post(**params) return hddadd ``` Feel free to close the issue if this works or comment back with any further errors! *(I didn't test this, but it should work)*
Author
Owner

@enimath commented on GitHub (Aug 2, 2021):

hello ,
it is working , thanks for help !
I had also add module
from typing_extensions import ParamSpec

<!-- gh-comment-id:890816165 --> @enimath commented on GitHub (Aug 2, 2021): hello , it is working , thanks for help ! I had also add module from typing_extensions import ParamSpec
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#30
No description provided.