Hello everyone! I'm trying to set template's cloud-init configs via proxmox-api-go package's proxmox.Client.SetVmConfig() method. I need to set username, password, ssh-key and network configs. I created variable map[string]interface{} with content:
{
"ipconfig0": NewNet0Cfg,
"ciuser": username,
"cipassword": password,
"sshkeys": encodedKey,
}
all these keys's values hane type string
I have problem only whith sshkey. First I created variable SshKey := "ssh-rsa AAAAB3...."
Then I tried to urlencode it wirh net/url package :
encodedKey := url.QueryEscape(SshKey)
But when I call SetVmConfig() method I get this responce:
RESULT:
HTTP/1.1 400 Parameter verification failed.
Connection: close
Content-Length: 698
Cache-Control: max-age=0
Content-Type: application/json;charset=UTF-8
Date: Fri, 21 Apr 2023 11:57:08 GMT
Expires: Fri, 21 Apr 2023 11:57:08 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
{"errors":{"sshkeys":"invalid format - invalid urlencoded string: ssh-rsa+AAAAB3NzaC1yc2EAAAADAQABAAABgQD02Ls76J6njonSYyWAovbUYJnLrNzt%2F6fiXZp1Pbae0egMTb8UgdOrecharIy6EKLmjCGfyZs8Klhg%2BEaDA9O8iTRn%2BHpRUrJhmFdxwaraQ2xEvL6slburbu9vB3vgJxT0oFAHW4osobLPXrZ%2BYZHRZjK9zi%2BW%2FxnLJZFOokWAWKCbYa52%2B7i%2Fk5a605LkZnbO5So3urTurvmdAD7mgBDyngQ2dCUajoAE8RW4aUfkfJoTd9aS6x663%2F19jtR3iyOMsaAxIw4QbRLK3%2FEZBA88cySYglx8xzy4tSXwag1KxXHrWNqiE%2BYSRuhHybfeL22ZXwDmx3zWMLgfZDu3bcOX%2FifVOpCqTMPECT03lIX1HBF%2FSTJQN0IVKPyFFOzLmAfge%2BaP3DopjEL2JHAsA9BSKETO76IeAZNtcKt%2FAFs5KugqMxCLIWQ0Q4uyFp8bJ2f8DOLDV8VvOeHM9aaVOhbXZ%2Fe%2FM%2BmsmV8cl1CWex3kWG7CZLq77FDR1d7qbhfYVH8%3D+kochevoy%40kochevoy-gen2\n"},"data":null}
Can you help me solve this problem please?
{
"ipconfig0": NewNet0Cfg,
"ciuser": username,
"cipassword": password,
"sshkeys": encodedKey,
}
all these keys's values hane type string
I have problem only whith sshkey. First I created variable SshKey := "ssh-rsa AAAAB3...."
Then I tried to urlencode it wirh net/url package :
encodedKey := url.QueryEscape(SshKey)
But when I call SetVmConfig() method I get this responce:
RESULT:
HTTP/1.1 400 Parameter verification failed.
Connection: close
Content-Length: 698
Cache-Control: max-age=0
Content-Type: application/json;charset=UTF-8
Date: Fri, 21 Apr 2023 11:57:08 GMT
Expires: Fri, 21 Apr 2023 11:57:08 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
{"errors":{"sshkeys":"invalid format - invalid urlencoded string: ssh-rsa+AAAAB3NzaC1yc2EAAAADAQABAAABgQD02Ls76J6njonSYyWAovbUYJnLrNzt%2F6fiXZp1Pbae0egMTb8UgdOrecharIy6EKLmjCGfyZs8Klhg%2BEaDA9O8iTRn%2BHpRUrJhmFdxwaraQ2xEvL6slburbu9vB3vgJxT0oFAHW4osobLPXrZ%2BYZHRZjK9zi%2BW%2FxnLJZFOokWAWKCbYa52%2B7i%2Fk5a605LkZnbO5So3urTurvmdAD7mgBDyngQ2dCUajoAE8RW4aUfkfJoTd9aS6x663%2F19jtR3iyOMsaAxIw4QbRLK3%2FEZBA88cySYglx8xzy4tSXwag1KxXHrWNqiE%2BYSRuhHybfeL22ZXwDmx3zWMLgfZDu3bcOX%2FifVOpCqTMPECT03lIX1HBF%2FSTJQN0IVKPyFFOzLmAfge%2BaP3DopjEL2JHAsA9BSKETO76IeAZNtcKt%2FAFs5KugqMxCLIWQ0Q4uyFp8bJ2f8DOLDV8VvOeHM9aaVOhbXZ%2Fe%2FM%2BmsmV8cl1CWex3kWG7CZLq77FDR1d7qbhfYVH8%3D+kochevoy%40kochevoy-gen2\n"},"data":null}
Can you help me solve this problem please?