stefan218921 opened a new issue, #14728:
URL: https://github.com/apache/cloudstack/issues/14728
### problem
Is there a supported way to remove all CloudStack-managed SSH key pairs from
an existing VM using the CloudStack API? `resetSSHKeyForVirtualMachine` seems
like the appropriate operation, but supplying empty key-pair values returns:
```
'keypair' or 'keypairs' must be specified
```
We reproduced this through `cloudstack-go`. Because the validation appears
to happen server-side, we expect a direct API request to encounter the same
limitation, although we have not tested one separately.
### versions
Apache CloudStack: 4.23.0.0
cloudstack-go: v2.19.1
Environment: CloudStack simulator (also tested on our actual CloudStack
environment which matches the simulator behaviour)
Hypervisor, storage, network: N/A
### The steps to reproduce the bug
1. Create a VM with an SSH key pair and stop the VM.
2. Attempt to reset its keys to no key pairs using cloudstack-go:
```
params := client.SSH.NewResetSSHKeyForVirtualMachineParams(vm.Id)
params.SetKeypairs([]string{""}) # or params.SetKeypairs([]string{})
params.SetKeypair("")
_, err := client.SSH.ResetSSHKeyForVirtualMachine(params)
```
3. Observe the error: 'keypair' or 'keypairs' must be specified.
**Expected:** There is a documented API operation to remove all
CloudStack-managed SSH key pairs from the VM.
**Actual:** The reset operation cannot represent zero key pairs.
### What to do about it?
Could you provide a way to clear all SSH key pairs from a VM through the
CloudStack API? If this is already possible, could you point us to the correct
operation or parameters? It would also help to clarify whether that operation
removes keys from the guest’s `authorized_keys` file or only changes the
CloudStack-managed key-pair association.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]