Reformat everything.

This commit is contained in:
Felix Fontein
2025-11-01 12:08:41 +01:00
parent 3f2213791a
commit 340ff8586d
1008 changed files with 61301 additions and 58309 deletions

View File

@@ -12,24 +12,43 @@ from ansible_collections.community.general.plugins.inventory.lxd import Inventor
HOST_COMPARATIVE_DATA = {
'ansible_connection': 'ssh', 'ansible_host': '10.98.143.199', 'ansible_lxd_os': 'ubuntu', 'ansible_lxd_release': 'focal',
'ansible_lxd_profile': ['default'], 'ansible_lxd_state': 'running', 'ansible_lxd_location': 'Berlin',
'ansible_lxd_vlan_ids': {'my-macvlan': 666}, 'inventory_hostname': 'vlantest', 'inventory_hostname_short': 'vlantest'}
"ansible_connection": "ssh",
"ansible_host": "10.98.143.199",
"ansible_lxd_os": "ubuntu",
"ansible_lxd_release": "focal",
"ansible_lxd_profile": ["default"],
"ansible_lxd_state": "running",
"ansible_lxd_location": "Berlin",
"ansible_lxd_vlan_ids": {"my-macvlan": 666},
"inventory_hostname": "vlantest",
"inventory_hostname_short": "vlantest",
}
GROUP_COMPARATIVE_DATA = {
'all': [], 'ungrouped': [], 'testpattern': ['vlantest'], 'vlan666': ['vlantest'], 'locationBerlin': ['vlantest'],
'osUbuntu': ['vlantest'], 'releaseFocal': ['vlantest'], 'releaseBionic': [], 'profileDefault': ['vlantest'],
'profileX11': [], 'netRangeIPv4': ['vlantest'], 'netRangeIPv6': ['vlantest']}
"all": [],
"ungrouped": [],
"testpattern": ["vlantest"],
"vlan666": ["vlantest"],
"locationBerlin": ["vlantest"],
"osUbuntu": ["vlantest"],
"releaseFocal": ["vlantest"],
"releaseBionic": [],
"profileDefault": ["vlantest"],
"profileX11": [],
"netRangeIPv4": ["vlantest"],
"netRangeIPv6": ["vlantest"],
}
GROUP_Config = {
'testpattern': {'type': 'pattern', 'attribute': 'test'},
'vlan666': {'type': 'vlanid', 'attribute': 666},
'locationBerlin': {'type': 'location', 'attribute': 'Berlin'},
'osUbuntu': {'type': 'os', 'attribute': 'ubuntu'},
'releaseFocal': {'type': 'release', 'attribute': 'focal'},
'releaseBionic': {'type': 'release', 'attribute': 'bionic'},
'profileDefault': {'type': 'profile', 'attribute': 'default'},
'profileX11': {'type': 'profile', 'attribute': 'x11'},
'netRangeIPv4': {'type': 'network_range', 'attribute': '10.98.143.0/24'},
'netRangeIPv6': {'type': 'network_range', 'attribute': 'fd42:bd00:7b11:2167:216:3eff::/96'}}
"testpattern": {"type": "pattern", "attribute": "test"},
"vlan666": {"type": "vlanid", "attribute": 666},
"locationBerlin": {"type": "location", "attribute": "Berlin"},
"osUbuntu": {"type": "os", "attribute": "ubuntu"},
"releaseFocal": {"type": "release", "attribute": "focal"},
"releaseBionic": {"type": "release", "attribute": "bionic"},
"profileDefault": {"type": "profile", "attribute": "default"},
"profileX11": {"type": "profile", "attribute": "x11"},
"netRangeIPv4": {"type": "network_range", "attribute": "10.98.143.0/24"},
"netRangeIPv6": {"type": "network_range", "attribute": "fd42:bd00:7b11:2167:216:3eff::/96"},
}
@pytest.fixture
@@ -38,13 +57,13 @@ def inventory():
inv.inventory = InventoryData()
# Test Values
inv.data = inv.load_json_data('tests/unit/plugins/inventory/fixtures/lxd_inventory.atd') # Load Test Data
inv.data = inv.load_json_data("tests/unit/plugins/inventory/fixtures/lxd_inventory.atd") # Load Test Data
inv.groupby = GROUP_Config
inv.prefered_instance_network_interface = 'eth'
inv.prefered_instance_network_family = 'inet'
inv.filter = 'running'
inv.prefered_instance_network_interface = "eth"
inv.prefered_instance_network_family = "inet"
inv.filter = "running"
inv.dump_data = False
inv.type_filter = 'both'
inv.type_filter = "both"
return inv
@@ -56,7 +75,7 @@ def test_verify_file(tmp_path, inventory):
def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.lxd.yml') is False
assert inventory.verify_file("foobar.lxd.yml") is False
def test_build_inventory_hosts(inventory):
@@ -64,7 +83,7 @@ def test_build_inventory_hosts(inventory):
After the inventory plugin has run with the test data, the result of the host is checked."""
inventory._populate()
generated_data = inventory.inventory.get_host('vlantest').get_vars()
generated_data = inventory.inventory.get_host("vlantest").get_vars()
eq = True
for key, value in HOST_COMPARATIVE_DATA.items():
@@ -94,7 +113,7 @@ def test_build_inventory_groups_with_no_groupselection(inventory):
inventory.groupby = None
inventory._populate()
generated_data = inventory.inventory.get_groups_dict()
group_comparative_data = {'all': [], 'ungrouped': []}
group_comparative_data = {"all": [], "ungrouped": []}
eq = True
print(f"data: {generated_data}")