Skip to content

Commit

Permalink
Display "conditional change" column in pre-execution host meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Mar 9, 2024
1 parent 5eeff50 commit 34ac5d2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pyinfra_cli/prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def pretty_op_name(op_meta):

def print_meta(state: "State"):
rows: List[Tuple[Callable, Union[List[str], str]]] = [
(logger.info, ["Operation", "Hosts"]),
(logger.info, ["Operation", "Change", "Conditional Change"]),
]

for op_hash in state.get_op_order():
Expand All @@ -237,14 +237,18 @@ def print_meta(state: "State"):
logger.info,
[
pretty_op_name(state.op_meta[op_hash]),
"{0}{1}/{2} ({3})".format(
"-"
if len(hosts_in_op) == 0
else "{0} ({1})".format(
len(hosts_in_op),
f"-{len(hosts_maybe_in_op)}" if hosts_maybe_in_op else "",
len(state.inventory),
truncate(", ".join(sorted(hosts_in_op + hosts_maybe_in_op)), 48),
)
if hosts_in_op or hosts_maybe_in_op
else "No hosts with changes at this time",
truncate(", ".join(sorted(hosts_in_op)), 48),
),
"-"
if len(hosts_maybe_in_op) == 0
else "{0} ({1})".format(
len(hosts_maybe_in_op),
truncate(", ".join(sorted(hosts_maybe_in_op)), 48),
),
],
)
)
Expand Down

0 comments on commit 34ac5d2

Please sign in to comment.