Fix inventory: server type had the wrong value (#78)

This commit is contained in:
Lukas Kämmerling 2021-04-14 09:57:35 +02:00 committed by GitHub
parent c46d09bda5
commit 45af6f150c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- inventory fix image name was set as server type instead of the correct server type

View file

@ -210,10 +210,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
"You can only connect via private IPv4 if you specify a network")
# Server Type
if server.image is not None and server.image.name is not None:
self.inventory.set_variable(server.name, "server_type", to_native(server.image.name))
if server.server_type is not None:
self.inventory.set_variable(server.name, "server_type", to_native(server.server_type.name))
else:
self.inventory.set_variable(server.name, "server_type", to_native("No Image name found."))
self.inventory.set_variable(server.name, "server_type", to_native("No server type name found."))
# Datacenter
self.inventory.set_variable(server.name, "datacenter", to_native(server.datacenter.name))