|
10 | 10 |
|
11 | 11 | from osism import settings |
12 | 12 | from osism.commands.console import resolve_host_with_fallback |
13 | | -from osism.utils.inventory import get_inventory_path |
| 13 | +from osism.utils.inventory import get_hosts_from_inventory, get_inventory_path |
14 | 14 | from osism.utils.ssh import ensure_known_hosts_file, KNOWN_HOSTS_PATH |
15 | 15 |
|
16 | 16 |
|
@@ -56,7 +56,7 @@ def take_action(self, parsed_args): |
56 | 56 | return |
57 | 57 |
|
58 | 58 | data = json.loads(result.stdout) |
59 | | - hosts = sorted(data.get("_meta", {}).get("hostvars", {}).keys()) |
| 59 | + hosts = get_hosts_from_inventory(data) |
60 | 60 |
|
61 | 61 | if not hosts: |
62 | 62 | logger.error("No hosts found in inventory.") |
@@ -194,7 +194,7 @@ def take_action(self, parsed_args): |
194 | 194 | return |
195 | 195 |
|
196 | 196 | data = json.loads(result.stdout) |
197 | | - hosts = sorted(data.get("_meta", {}).get("hostvars", {}).keys()) |
| 197 | + hosts = get_hosts_from_inventory(data) |
198 | 198 |
|
199 | 199 | if not hosts: |
200 | 200 | logger.error("No hosts found in inventory.") |
@@ -341,7 +341,7 @@ def take_action(self, parsed_args): |
341 | 341 | return |
342 | 342 |
|
343 | 343 | data = json.loads(result.stdout) |
344 | | - hosts = sorted(data.get("_meta", {}).get("hostvars", {}).keys()) |
| 344 | + hosts = get_hosts_from_inventory(data) |
345 | 345 |
|
346 | 346 | if not hosts: |
347 | 347 | logger.error("No hosts found in inventory.") |
|
0 commit comments