Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:thlisym/hetznercloud-py into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
thlisym committed Sep 2, 2018
2 parents 9ba3593 + 706b0c4 commit 38be4fa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ promptly reviewed and evaluated on its suitability to be merged into the main br

### v1.1.0

* Allows new datacenters to be created in any datacenter in a selected location. See [pull request 16]().
* Allows new servers to be created in any datacenter in a selected location. See [pull request 16]().

### v1.0.4

Expand Down Expand Up @@ -209,14 +209,23 @@ Constants that represent the server types available to users.
* `SERVER_TYPE_8CPU_32GB` - The largest type with 8 CPU cores, 32GB of RAM and a 240GB SSD disk.
* `SERVER_TYPE_8CPU_32GB_CEPH` - The same as above but with a 240GB CEPH network-attached disk.


* `SERVER_TYPE_2CPU_8GB_DVCPU` - 2 dedicated CPU cores, 8GB of RAM and 80GB SSD disk.
* `SERVER_TYPE_4CPU_16GB_DVCPU` - 4 dedicated CPU cores, 16GB of RAM and 160GB SSD disk.
* `SERVER_TYPE_8CPU_32GB_DVCPU` - 8 dedicated CPU cores, 32GB of RAM and 240GB SSD disk.
* `SERVER_TYPE_16CPU_64GB_DVCPU` - 16 dedicated CPU cores, 64GB of RAM and 360GB SSD disk.
* `SERVER_TYPE_32CPU_128GB_DVCPU` - 32 dedicated CPU cores, 128GB of RAM and 540GB SSD disk.

##### Image types

Constants that represent the standard images available to users.

* `IMAGE_UBUNTU_1604` - Ubuntu 16.04 LTS
* `IMAGE_UBUNTU_1804` - Ubuntu 18.04 LTS
* `IMAGE_DEBIAN_9` - Debian 9.3
* `IMAGE_CENTOS_7` - CentOS 7.4
* `IMAGE_CENTOS_7` - CentOS 7.5
* `IMAGE_FEDORA_27` - Fedora 27
* `IMAGE_FEDORA_28` - Fedora 28

##### Datacentre constants

Expand Down Expand Up @@ -575,15 +584,20 @@ To create a server, you can call the `create` top level action method. This meth
are optional, some aren't).

```python
server_a, create_action = client.servers().create(name="My required server name", # REQUIRED
server_a, create_action = client.servers().create(name="my-required-server-name", # REQUIRED
server_type=SERVER_TYPE_1CPU_2GB, # REQUIRED
image=IMAGE_UBUNTU_1604, # REQUIRED
datacenter=DATACENTER_FALKENSTEIN_1,
start_after_create=True,
ssh_keys=["my-ssh-key-1", "my-ssh-key-2"],
user_data="rm -rf a-file")
user_data='''#cloud-config
packages:
- screen
- git
''')
server_a.wait_until_status_is(SERVER_STATUS_RUNNING)
```
For more details on user_data please see https://cloudinit.readthedocs.io/en/latest/topics/examples.html

#### Server modifier actions

Expand Down
6 changes: 6 additions & 0 deletions hetznercloud/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
SERVER_TYPE_8CPU_32GB = "cx51"
SERVER_TYPE_8CPU_32GB_CEPH = "cx51-ceph"

SERVER_TYPE_2CPU_8GB_DVCPU = "ccx11"
SERVER_TYPE_4CPU_16GB_DVCPU = "ccx21"
SERVER_TYPE_8CPU_32GB_DVCPU = "ccx31"
SERVER_TYPE_16CPU_64GB_DVCPU = "ccx41"
SERVER_TYPE_32CPU_128GB_DVCPU = "ccx51"

IMAGE_UBUNTU_1604 = "ubuntu-16.04"
IMAGE_UBUNTU_1804 = "ubuntu-18.04"
IMAGE_DEBIAN_9 = "debian-9"
Expand Down
2 changes: 2 additions & 0 deletions hetznercloud/floating_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class HetznerCloudFloatingIp(object):
def __init__(self, config):
self._config = config
self.id = 0
self.ip = ""
self.description = ""
self.type = ""
self.server = 0
Expand Down Expand Up @@ -108,6 +109,7 @@ def _load_from_json(config, json):

float_ip.id = int(json["id"])
float_ip.description = json["description"]
float_ip.ip = json["ip"]
float_ip.type = json["type"]
float_ip.server = int(json["server"]) if json["server"] is not None else 0
float_ip.ptr_ips = [entry["ip"] for entry in json["dns_ptr"]]
Expand Down
4 changes: 2 additions & 2 deletions hetznercloud/ssh_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, config):

def delete(self):
status_code, result = _get_results(self._config, "ssh_keys/%s" % self.id, method="DELETE")
if status_code != 201:
if status_code != 204:
raise HetznerActionException(result)

def update(self, name):
Expand All @@ -69,4 +69,4 @@ def _load_from_json(config, json):
ssh_key.fingerprint = json["fingerprint"]
ssh_key.public_key = json["public_key"]

return ssh_key
return ssh_key

0 comments on commit 38be4fa

Please sign in to comment.