Fix hcloud_server and hcloud_server_info module when the image is None (#66234)
This commit is contained in:
parent
cb46e5f06b
commit
8743ff02c0
2 changed files with 4 additions and 2 deletions
|
@ -272,12 +272,13 @@ class AnsibleHcloudServer(Hcloud):
|
|||
self.hcloud_server = None
|
||||
|
||||
def _prepare_result(self):
|
||||
image = None if self.hcloud_server.image is None else to_native(self.hcloud_server.image.name)
|
||||
return {
|
||||
"id": to_native(self.hcloud_server.id),
|
||||
"name": to_native(self.hcloud_server.name),
|
||||
"ipv4_address": to_native(self.hcloud_server.public_net.ipv4.ip),
|
||||
"ipv6": to_native(self.hcloud_server.public_net.ipv6.ip),
|
||||
"image": to_native(self.hcloud_server.image.name),
|
||||
"image": image,
|
||||
"server_type": to_native(self.hcloud_server.server_type.name),
|
||||
"datacenter": to_native(self.hcloud_server.datacenter.name),
|
||||
"location": to_native(self.hcloud_server.datacenter.location.name),
|
||||
|
|
|
@ -150,12 +150,13 @@ class AnsibleHcloudServerInfo(Hcloud):
|
|||
|
||||
for server in self.hcloud_server_info:
|
||||
if server is not None:
|
||||
image = None if server.image is None else to_native(server.image.name)
|
||||
tmp.append({
|
||||
"id": to_native(server.id),
|
||||
"name": to_native(server.name),
|
||||
"ipv4_address": to_native(server.public_net.ipv4.ip),
|
||||
"ipv6": to_native(server.public_net.ipv6.ip),
|
||||
"image": to_native(server.image.name),
|
||||
"image": image,
|
||||
"server_type": to_native(server.server_type.name),
|
||||
"datacenter": to_native(server.datacenter.name),
|
||||
"location": to_native(server.datacenter.location.name),
|
||||
|
|
Loading…
Reference in a new issue