Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Hashtables into appropriate querystring values #12

Closed
1 task
XNoobMaster69 opened this issue Jan 3, 2024 · 0 comments
Closed
1 task

Convert Hashtables into appropriate querystring values #12

XNoobMaster69 opened this issue Jan 3, 2024 · 0 comments

Comments

@XNoobMaster69
Copy link

What happened?

I tried to pass a <Hashtable> argument to the Module, but I kept getting a response with a status code of 400. Here's the example:

$networkConfig = @{
    1 = @{
        model = 'virtio';
        bridge = 'vmbr0';
        macaddr = $mac;
    };
}

$storageConfig = @{
    1 = 'local-lvm:32';
}

$bootableIso = @{
    1 = 'local:iso/ubuntu.iso'
}

New-PveNodesQemu -Node $node -Vmid 105 -Memory 2048 -ScsiN $storageConfig -IdeN $bootableIso -NetN $networkConfig

To resolve the issue, I received a suggestion to change the variable to $networkConfig = @{ 1 = "model=virtio,bridge=vmbr0,macaddr=$mac" } , but during debugging, I noticed that the value was not properly escaped in the URI.

The only way for $networkConfig to be accepted was to format it like this:
$networkConfig = @{ 1 = "model%3Dvirtio%2Cbridge%3Dvmbr0%2Cmacaddr%3D$mac" }

Expected behavior

Accept <Hashtable> Format and maybe add a simple example to the documentation about the correct aproach.

Relevant log output

No response

Proxmox VE Version

8.1.3

Version (bug)

8.1.0

Version (working)

No response

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant