def decommission_unused(): """De-provisions inactive and orphan nodes.""" configure() nodes = classify_nodes() use_only(*nodes[INACTIVE] + nodes[ORPHAN]) if len(env.nodes) == 0: info("There are no inactive or orphan nodes to decommission.") else: decommission_nodes()
def decommission_all(): """De-provisions all nodes.""" configure() use_only(*instances_with_platform_and_role(env.platform, env.role)) if len(env.nodes) == 0: info("There are no nodes to decommission.") else: show() if confirm("Are you sure you want to decommission ALL %d nodes?" % len(env.nodes), default=False): decommission_nodes()