Fix image NoneType exception in hcloud_network_info (#56)

This commit is contained in:
Lukas Kämmerling 2021-02-23 06:47:53 +01:00 committed by GitHub
parent 0d955cab88
commit 9af840105a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,12 +219,13 @@ class AnsibleHcloudNetworkInfo(Hcloud):
servers = []
for server in network.servers:
image = None if server.image is None else to_native(server.image.name)
prepared_server = {
"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),