From e4501c1086b2205084e22a4d86dafe8341f275d0 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Fri, 15 Dec 2023 15:25:12 +0100 Subject: [PATCH] refactor: reorder inventory server type host vars (#427) Outlines the fact that `type` and `server_type` are the same value. --- plugins/inventory/hcloud.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/inventory/hcloud.py b/plugins/inventory/hcloud.py index f8ee043..c837728 100644 --- a/plugins/inventory/hcloud.py +++ b/plugins/inventory/hcloud.py @@ -169,16 +169,16 @@ if sys.version_info >= (3, 11): id: int name: str status: str + + # Server Type type: str + server_type: str architecture: str # Datacenter datacenter: str location: str - # Server Type - server_type: NotRequired[str] - # Labels labels: dict[str, str] @@ -306,7 +306,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): server_dict["id"] = server.id server_dict["name"] = to_native(server.name) server_dict["status"] = to_native(server.status) + + # Server Type server_dict["type"] = to_native(server.server_type.name) + server_dict["server_type"] = to_native(server.server_type.name) server_dict["architecture"] = to_native(server.server_type.architecture) # Network @@ -329,10 +332,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): server_dict["private_ipv4"] = to_native(private_net.ip) break - # Server Type - if server.server_type is not None: - server_dict["server_type"] = to_native(server.server_type.name) - # Datacenter server_dict["datacenter"] = to_native(server.datacenter.name) server_dict["location"] = to_native(server.datacenter.location.name)