cloud-init v19.1 fails to read user-data if a VM on CloudSigma doesn't have a ssh public key in VM properties/SSH keys

Bug #1834065 reported by Aki Ketolainen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Medium
Unassigned

Bug Description

I'm using python 3 to access CloudSigma resources.

There are two python libraries that can be used to access CloudSigma, libcloud and pycloudsigma.
Neither have functions to deal with VM instance ssh public keys. There are REST API paths
/api/2.0/keypairs/ and /api/2.0/pubkeys/ but they are not in either of the libraries' code)

I can't add the ssh_public_key to the VM metadata because it's a reserved word.
"! Reserved meta keys are: Description, ssh_public_key, optimize_for."
If I try to add it, it just disappears in the web dashboard.

The only choice for me seems to be using CloudSigma's web dashboard to attach the ssh public key
to the VM instance and that's not what I would like to do.

rharper on irc suggested to patch DataSourceCloudSigma.py to change

    self.ssh_public_key = server_meta['ssh_public_key'] to
    self.ssh_public_key = server_meta.get('ssh_public_key', '')

and it seems to work.

I've included the cloud-init collect-logs tar package.

Revision history for this message
Aki Ketolainen (akik) wrote :
Revision history for this message
Aki Ketolainen (akik) wrote :

What I meant with the "only choice for me" is that there's a separate tab in the CloudSigma web dashboard for the VM, "SSH Keys", where I can attach the ssh public key.

Revision history for this message
Aki Ketolainen (akik) wrote :

I was able to work around this problem by adding:

    "pubkeys": ["uuid"]

in the server definition json. The public key uuid can be found at
https://zrh.cloudsigma.com/ui/4.0/access/publicsshkeys

I found the solution here:

https://cloudsigma-docs.readthedocs.io/en/2.14/keypairs.html#pubkeys-resource

Revision history for this message
Aki Ketolainen (akik) wrote :
Revision history for this message
Dan Watkins (oddbloke) wrote :

Hi Aki,

Thanks for filing this bug! Is the suggested fix something that you would be interested in submitting to cloud-init yourself? If so, please see https://cloudinit.readthedocs.io/en/latest/topics/hacking.html for instructions on how to get started.

Thanks!

Dan

Changed in cloud-init:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Aki Ketolainen (akik) wrote :

Sorry, no.

Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.