diff --git a/changelogs/fragments/inventory-fix-server-type-wrong-value.yml b/changelogs/fragments/inventory-fix-server-type-wrong-value.yml new file mode 100644 index 0000000..19812fb --- /dev/null +++ b/changelogs/fragments/inventory-fix-server-type-wrong-value.yml @@ -0,0 +1,2 @@ +bugfixes: + - inventory fix image name was set as server type instead of the correct server type diff --git a/plugins/inventory/hcloud.py b/plugins/inventory/hcloud.py index 8371bdf..11e6d7b 100644 --- a/plugins/inventory/hcloud.py +++ b/plugins/inventory/hcloud.py @@ -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))