Skip to content

Create Server with ssh_keys failed #19

@telsch

Description

@telsch

Bug Report

Current Behavior
Tried to create a server from image with volume and ssh-keys failed:

sys.path.append('/home/user/hcloud-python/')
from hcloud import HcloudClient
client = HcloudClient(token=token)

volumes = client.volumes.get_by_id(id=vol_id)
ssh_keys = client.ssh_keys.get_all(name='user')

server = client.servers.create(name=vm, server_type=ServerType(name='cx11'), \
            image=Image(id=image_id), volumes=volumes, ssh_keys=ssh_keys)

Traceback (most recent call last):
  File "bin/hcloud-control.py", line 250, in <module>
    main(args)
  File "bin/hcloud-control.py", line 230, in main
    resume(client, args.vm)
  File "bin/hcloud-control.py", line 174, in resume
    image=Image(id=image_id), volumes=volumes, ssh_keys=ssh_keys)
  File "/home/user/hcloud-python/hcloud/servers/client.py", line 226, in create
    response = self._client.request(url="/servers", method="POST", json=data)
  File "/home/user/hcloud-python/hcloud/hcloud.py", line 109, in request
    self._raise_exception_from_json_content(json_content)
  File "/home/user/hcloud-python/hcloud/hcloud.py", line 84, in _raise_exception_from_json_content
    details=json_content['error']['details']
hcloud.hcloud.HcloudAPIException

if i put this in try...except block i got:
SSH key 'ssh_key_id not found

Environment
OS: Ubuntu 18.04.2 LTS
Python Version: v3.6.7
Hcloud-Python Version: 95120b9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions