[GH-ISSUE #52] is there anyway to whit 1 method , start or stop lxc and qemu? #27

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

Originally created by @acairon on GitHub (Apr 25, 2021).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/52

Hello i have this 2 methods

proxmox.nodes(env("PROX_NODE")).lxc(vmid).status.post(action)

and

proxmox.nodes(env("PROX_NODE")).qemu(vmid).status.post(action)

is there anyway i can do 2 methods in one?

like

def method(vmid,type)

proxmox.nodes(env("PROX_NODE")).$type(vmid).status.post(action)

or somethin

Originally created by @acairon on GitHub (Apr 25, 2021). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/52 Hello i have this 2 methods proxmox.nodes(env("PROX_NODE")).lxc(vmid).status.post(action) and proxmox.nodes(env("PROX_NODE")).qemu(vmid).status.post(action) is there anyway i can do 2 methods in one? like def method(vmid,type) proxmox.nodes(env("PROX_NODE")).$type(vmid).status.post(action) or somethin
kerem closed this issue 2026-02-27 15:46:02 +03:00
Author
Owner

@morph027 commented on GitHub (Apr 25, 2021):

Nothing to do with proxmoxer in special, but you can do smthg. like

def pve_action(type, action):
    methods = {
        "lxc": proxmox.nodes(env("PROX_NODE")).lxc,
        "qemu": proxmox.nodes(env("PROX_NODE")).qemu
    }
    return methods.get(type)

pve_action(type, action).status.post(action)
<!-- gh-comment-id:826294635 --> @morph027 commented on GitHub (Apr 25, 2021): Nothing to do with proxmoxer in special, but you can do smthg. like ``` def pve_action(type, action): methods = { "lxc": proxmox.nodes(env("PROX_NODE")).lxc, "qemu": proxmox.nodes(env("PROX_NODE")).qemu } return methods.get(type) pve_action(type, action).status.post(action) ```
Author
Owner

@acairon commented on GitHub (Apr 25, 2021):

sorry if it's a stupid question, as a student I'm learning little by little xD :/

<!-- gh-comment-id:826302993 --> @acairon commented on GitHub (Apr 25, 2021): sorry if it's a stupid question, as a student I'm learning little by little xD :/
Author
Owner

@morph027 commented on GitHub (Apr 25, 2021):

No problem, you're welcome! There are no dumb questions ;)

<!-- gh-comment-id:826330577 --> @morph027 commented on GitHub (Apr 25, 2021): No problem, you're welcome! There are no dumb questions ;)
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#27
No description provided.