Fix the create node example.# Please enter the commit message for your changes. Lines starting
@@ -2,21 +2,29 @@ from libcloud.compute.providers import get_driver
from libcloud.compute.base import NodeSize
from libcloud.compute.type import Provider
-driver = get_driver(Provider.GRIDSCALE)
-
-driver = driver('USER-UUID', 'API-TOKEN')
+cls = get_driver(Provider.GRIDSCALE)
+driver = cls('USER-UUID', 'API-TOKEN')
# We don't feature packages containing a fix size so you will have to
# built your own size object. Make sure to use a multiple of 1024MB when
# asigning RAM
-name = 'my-node-size'
-size = NodeSize(id=0, bandwidth=0, price=0, name=name, ram=10240,
- driver=driver, extra={'cores': 2})
+size_name = 'my-node-size'
+ram = 1024 # amout of ram In MB
+disk = 10 # disk size in GB
+cores = 1 # numer of cores node should have
+size = NodeSize(id=0, bandwidth=0, price=0, name=size_name, ram=ram, disk=disk,
+ driver=driver, extra={'cores': cores})
ssh_key = driver.list_key_pairs()[0]
ssh_key_uuid = ssh_key.fingerprint
-name = 'MyServer'
-location = driver.list_locations()[0]
-image = driver.list_images()[0]
-node = driver.create_node(name, size, location, ex_ssh_key_ids=ssh_key)
+node_name = 'MyServer'
+
+images = driver.list_images()
+image = [i for i in images if i.name == 'Ubuntu 18.04 LTS'][0]
+
+locations = driver.list_locations()
+location = [l for l in locations if l.name == 'de/fra'][0]
+
+node = driver.create_node(name=node_name, size=size, image=image,
+ location=location, ex_ssh_key_ids=ssh_key)
