def _build_cluster_configs(cluster_list):
    cluster_configs = []
    for cluster in cluster_list:
        username, password, verify_ssl = _get_cluster_auth_data(cluster)

        if cluster in g_cluster_configs:
            cluster_name, isi_sdk, api_client, version = g_cluster_configs[
                cluster]
        else:
            if verify_ssl is False:
                urllib3.disable_warnings()
            try:
                isi_sdk, api_client, version = isi_sdk_utils.configure(
                    cluster, username, password, verify_ssl)
            except RuntimeError as exc:
                print(
                    "Failed to configure SDK for "
                    "cluster %s. Exception raised: %s" % (cluster, str(exc)),
                    file=sys.stderr,
                )
                sys.exit(1)
            print("Configured %s as version %d cluster, using SDK %s." %
                  (cluster, int(version), isi_sdk.__name__))
            cluster_name = _query_cluster_name(cluster, isi_sdk, api_client)
            g_cluster_configs[
                cluster] = cluster_name, isi_sdk, api_client, version

        cluster_config = ClusterConfig(cluster, cluster_name, version, isi_sdk,
                                       api_client)
        cluster_configs.append(cluster_config)

    return cluster_configs
def _build_cluster_configs(cluster_list):
    cluster_configs = []
    for cluster in cluster_list:
        username, password, verify_ssl = _get_cluster_auth_data(cluster)

        if cluster in g_cluster_configs:
            cluster_name, isi_sdk, api_client, version = \
                    g_cluster_configs[cluster]
        else:
            if verify_ssl is False:
                urllib3.disable_warnings()
            try:
                isi_sdk, api_client, version = \
                        isi_sdk_utils.configure(
                                cluster, username, password, verify_ssl)
            except RuntimeError as exc:
                print >> sys.stderr, "Failed to configure SDK for " \
                        "cluster %s. Exception raised: %s" \
                        % (cluster, str(exc))
                sys.exit(1)
            print "Configured %s as version %d cluster, using SDK %s." \
                    % (cluster, int(version), isi_sdk.__name__)
            cluster_name = \
                    _query_cluster_name(cluster, isi_sdk, api_client)
            g_cluster_configs[cluster] = \
                    cluster_name, isi_sdk, api_client, version

        cluster_config = \
                ClusterConfig(
                        cluster, cluster_name, version, isi_sdk, api_client)
        cluster_configs.append(cluster_config)

    return cluster_configs