16 lines
554 B
Python
16 lines
554 B
Python
def print_plan(plan):
|
|
if not plan:
|
|
print("Desired state contains no records.")
|
|
return
|
|
|
|
for item in plan:
|
|
h = item.desired.hostname
|
|
if item.action == "ADD":
|
|
print(f"{'ADD':<10} {h:<45} -> {item.desired.ip}")
|
|
elif item.action == "UPDATE":
|
|
print(f"{'UPDATE':<10} {h:<45} {item.current.ip} -> {item.desired.ip}")
|
|
elif item.action == "SKIP":
|
|
print(f"{'SKIP':<10} {h:<45} {item.reason}")
|
|
else:
|
|
print(f"{'UNCHANGED':<10} {h:<45} {item.desired.ip}")
|