exoscale/python-exoscale

ssh-key option not working when creating a nodepool

Closed this issue · 2 comments

Hello
I am trying to create a instance_pool and passing my ssh key to all the instances.
I've created a ssh key on my host machine and also added the key in my exoscale account
I've written:

exo = exoscale.Exoscale(config_file=str(Path.home())+"/.config/exoscale/exoscale.toml")    
key = exo.compute.get_ssh_key("My SSH key") 
zone = exo.compute.get_zone("some_zone")
print(key)
# returns: SSHKey(name='My SSH key', fingerprint='correct fingerprint')
instance_pool = exo.compute.create_instance_pool(    
    zone = zone,    
    name = "some_name",    
    size = 10,    
    instance_type=exo.compute.get_instance_type("medium"),    
    instance_template=exo.compute.get_instance_template(    
        zone,    
        "54d8e676-d46a-4559-87e7-e0feed79e770"),    
    instance_ssh_key=key,     
    description="some_description",    
    instance_user_data="#cloud-config")    

The error i receive is:

{
   "errors":[
      {
         "in":[
            "ssh-key"
         ],
         "path":"ssh-key",
         "message":"should be a Map",
         "description":"SSH key"
      }
   ],
   "message":"Invalid value in ssh-key (description: `SSH key`) - should be a Map\n"
}

which tells me, that your python-exoscale library is not having any problem with the datatype is specified but the underlying openapi-v2.exoscale.com - api
So i guess there must be some problem when calling the api in your python-exoscale lib?

Without specifying an ssh-key the instance-pool generation is working fine.

Some help or fixes would be very nice.

Greets HD

Hello @hannes-unite!

Thanks for your interest in this project.
We fixed the issue in this PR.

Thank you very much, it is working fine !