mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-11-10 06:34:13 +00:00
hcloud_volume & hcloud_volume_info: "None" -> null (#165)
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:
parent
d1c97c7e89
commit
123ad2c1b0
3 changed files with 7 additions and 4 deletions
3
changelogs/fragments/hcloud_volume_server_none.yml
Normal file
3
changelogs/fragments/hcloud_volume_server_none.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bugfixes:
|
||||
- hcloud_volume - fix server name was given out as "None" instead of null if no server was attached
|
||||
- hcloud_volume_info - fix server name was given out as "None" instead of null if no server was attached
|
|
@ -183,7 +183,7 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
def _prepare_result(self):
|
||||
server_name = None
|
||||
if self.hcloud_volume.server is not None:
|
||||
server_name = self.hcloud_volume.server.name
|
||||
server_name = to_native(self.hcloud_volume.server.name)
|
||||
|
||||
return {
|
||||
"id": to_native(self.hcloud_volume.id),
|
||||
|
@ -191,7 +191,7 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
"size": self.hcloud_volume.size,
|
||||
"location": to_native(self.hcloud_volume.location.name),
|
||||
"labels": self.hcloud_volume.labels,
|
||||
"server": to_native(server_name),
|
||||
"server": server_name,
|
||||
"linux_device": to_native(self.hcloud_volume.linux_device),
|
||||
"delete_protection": self.hcloud_volume.protection["delete"],
|
||||
}
|
||||
|
|
|
@ -117,14 +117,14 @@ class AnsibleHcloudVolumeInfo(Hcloud):
|
|||
if volume is not None:
|
||||
server_name = None
|
||||
if volume.server is not None:
|
||||
server_name = volume.server.name
|
||||
server_name = to_native(volume.server.name)
|
||||
tmp.append({
|
||||
"id": to_native(volume.id),
|
||||
"name": to_native(volume.name),
|
||||
"size": volume.size,
|
||||
"location": to_native(volume.location.name),
|
||||
"labels": volume.labels,
|
||||
"server": to_native(server_name),
|
||||
"server": server_name,
|
||||
"linux_device": to_native(volume.linux_device),
|
||||
"delete_protection": volume.protection["delete"],
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue