]> xn--ix-yja.es Git - alex.git/commitdiff
Cater for unmonitored hosts
authoralex <alex@pdp7.net>
Thu, 7 Nov 2024 19:46:24 +0000 (20:46 +0100)
committeralexpdp7 <alex@corcoles.net>
Thu, 7 Nov 2024 19:47:22 +0000 (20:47 +0100)
personal_infra/pseudo_resource_exporter.py

index 9ef498bb06f94c47ea5c0a9bc1316d8aac38f8c2..fb961c677c9f164fe490286a401e930c67ff41e2 100755 (executable)
@@ -47,7 +47,9 @@ ail = subprocess.run(["ansible-inventory", "--list"], check=True, stdout=subproc
 inventory = json.loads(ail.stdout)
 total_hosts_in_inventory = len(inventory["_meta"]["hostvars"].keys())
 k8s_hosts_in_inventory = len(inventory["k8s"]["hosts"])
-puppet_hosts_in_inventory = total_hosts_in_inventory - k8s_hosts_in_inventory
+unmonitored_hosts_in_inventory = len(inventory["unmonitored"]["hosts"])
+
+puppet_hosts_in_inventory = total_hosts_in_inventory - k8s_hosts_in_inventory - unmonitored_hosts_in_inventory
 
 catalog_files = list(pathlib.Path("build/puppet/build/output/").glob("*/catalog.json"))