def check_pending_reboot_status()

in configurations/RedshiftConfigTestingLambda.py [0:0]


def check_pending_reboot_status(client,cluster_identifier):
    try:
        cluster_desc = client.describe_clusters(ClusterIdentifier=cluster_identifier)['Clusters'][0]
        desc_paramgroup_status = cluster_desc['ClusterParameterGroups'][0]['ParameterApplyStatus']
        status = cluster_desc.get('ClusterStatus') + cluster_desc.get('ClusterAvailabilityStatus') + desc_paramgroup_status
        if desc_paramgroup_status == 'pending-reboot':
                print('Cluster {} needs to be rebooted to apply the WLM config changes'.format(cluster_identifier))
                client.reboot_cluster(ClusterIdentifier=cluster_identifier)
    except Exception as err:
        print(err)
        status = 'availableAvailablein-sync'
    return status