hcloud_server & hcloud_server_info fix backup window given out as "None" (#162)

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
This commit is contained in:
Lukas Kämmerling 2022-11-07 14:49:19 +01:00 committed by GitHub
parent 5cc7c58ecf
commit 78f0a0a519
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- hcloud_server - fix backup window was given out as "None" instead of null
- hcloud_server_info - fix backup window was given out as "None" instead of null

View file

@ -339,6 +339,7 @@ class AnsibleHcloudServer(Hcloud):
ipv4_address = None if self.hcloud_server.public_net.ipv4 is None else to_native( ipv4_address = None if self.hcloud_server.public_net.ipv4 is None else to_native(
self.hcloud_server.public_net.ipv4.ip) self.hcloud_server.public_net.ipv4.ip)
ipv6 = None if self.hcloud_server.public_net.ipv6 is None else to_native(self.hcloud_server.public_net.ipv6.ip) ipv6 = None if self.hcloud_server.public_net.ipv6 is None else to_native(self.hcloud_server.public_net.ipv6.ip)
backup_window = None if self.hcloud_server.backup_window is None else to_native(self.hcloud_server.backup_window)
return { return {
"id": to_native(self.hcloud_server.id), "id": to_native(self.hcloud_server.id),
"name": to_native(self.hcloud_server.name), "name": to_native(self.hcloud_server.name),
@ -350,7 +351,7 @@ class AnsibleHcloudServer(Hcloud):
"location": to_native(self.hcloud_server.datacenter.location.name), "location": to_native(self.hcloud_server.datacenter.location.name),
"placement_group": placement_group, "placement_group": placement_group,
"rescue_enabled": self.hcloud_server.rescue_enabled, "rescue_enabled": self.hcloud_server.rescue_enabled,
"backup_window": to_native(self.hcloud_server.backup_window), "backup_window": backup_window,
"labels": self.hcloud_server.labels, "labels": self.hcloud_server.labels,
"delete_protection": self.hcloud_server.protection["delete"], "delete_protection": self.hcloud_server.protection["delete"],
"rebuild_protection": self.hcloud_server.protection["rebuild"], "rebuild_protection": self.hcloud_server.protection["rebuild"],

View file

@ -155,6 +155,7 @@ class AnsibleHcloudServerInfo(Hcloud):
placement_group = None if server.placement_group is None else to_native(server.placement_group.name) placement_group = None if server.placement_group is None else to_native(server.placement_group.name)
ipv4_address = None if server.public_net.ipv4 is None else to_native(server.public_net.ipv4.ip) ipv4_address = None if server.public_net.ipv4 is None else to_native(server.public_net.ipv4.ip)
ipv6 = None if server.public_net.ipv6 is None else to_native(server.public_net.ipv6.ip) ipv6 = None if server.public_net.ipv6 is None else to_native(server.public_net.ipv6.ip)
backup_window = None if server.backup_window is None else to_native(server.backup_window)
tmp.append({ tmp.append({
"id": to_native(server.id), "id": to_native(server.id),
"name": to_native(server.name), "name": to_native(server.name),
@ -166,7 +167,7 @@ class AnsibleHcloudServerInfo(Hcloud):
"location": to_native(server.datacenter.location.name), "location": to_native(server.datacenter.location.name),
"placement_group": placement_group, "placement_group": placement_group,
"rescue_enabled": server.rescue_enabled, "rescue_enabled": server.rescue_enabled,
"backup_window": to_native(server.backup_window), "backup_window": backup_window,
"labels": server.labels, "labels": server.labels,
"status": to_native(server.status), "status": to_native(server.status),
"delete_protection": server.protection["delete"], "delete_protection": server.protection["delete"],