def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--power", required=True, default=None,
                        choices=["on", "off", "reset", "cycle"],
                        help="Control power state of all overcloud nodes")
    args = parser.parse_args()

    os_auth_url, os_tenant_name, os_username, os_password, \
        os_user_domain_name, os_project_domain_name = \
        CredentialHelper.get_undercloud_creds()

    kwargs = {'os_username': os_username,
              'os_password': os_password,
              'os_auth_url': os_auth_url,
              'os_tenant_name': os_tenant_name,
              'os_user_domain_name': os_user_domain_name,
              'os_project_domain_name': os_project_domain_name}
    ironic = client.get_client(1, **kwargs)

    for node in ironic.node.list(detail=True):
        ip, username, password = \
            CredentialHelper.get_drac_creds_from_node(node)

        cmd = "ipmitool -H {} -I lanplus -U {} -P '{}' chassis power {}". \
            format(ip, username, password, args.power)
        print(cmd)

        os.system(cmd)