Skip to content

Commit

Permalink
fix: show matched hosts when applying
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkirchberger committed Apr 18, 2022
1 parent afacfd6 commit c9bf83b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion nectl/configs/cli.py
Expand Up @@ -171,9 +171,12 @@ def apply_cmd(
print(f"Error: {e}")
sys.exit(1)

print("Applying config to:")
print("\n".join([f"- {host.id}" for host in hosts]))

if not assumeyes:
click.confirm(
f"Are you sure you want to modify {len(hosts)} live hosts?", abort=True
f"\nAre you sure you want to modify {len(hosts)} live hosts?", abort=True
)

sys.exit(
Expand Down
5 changes: 4 additions & 1 deletion nectl/datatree/hosts.py
Expand Up @@ -214,7 +214,10 @@ def is_match(host: Host) -> bool:
# Add host
hosts.append(host)

logger.info(f"hosts after filter: {len(hosts)}")
logger.info(
f"filter matched {len(hosts)} hosts: "
f"{','.join([host.id for host in hosts])}"
)

if len(hosts) == 0:
print("No hosts found.", file=sys.stderr)
Expand Down

0 comments on commit c9bf83b

Please sign in to comment.