refactor: reorder inventory server type host vars (#427)

Outlines the fact that `type` and `server_type` are the same value.
This commit is contained in:
Jonas L 2023-12-15 15:25:12 +01:00 committed by GitHub
parent fe4c924594
commit e4501c1086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)