Esempio n. 1
0
def stop_cluster_command(parsed_options):
    cluster_id = parsed_options["ClusterId"]
    cluster = repository.lookup_and_validate_cluster(cluster_id)

    if isinstance(cluster, ShardedCluster):
        stop_shard_cluster(cluster)
    else:
        stop_replicaset_cluster(cluster)
Esempio n. 2
0
def configure_sharded_cluster_command(parsed_options):
    cluster_id = parsed_options.cluster
    cluster = repository.lookup_and_validate_cluster(cluster_id)

    if not isinstance(cluster, ShardedCluster):
        raise MongoctlException(
            "Cluster '%s' is not a ShardedCluster cluster" % cluster.id)

    if parsed_options.dryRun:
        dry_run_configure_sharded_cluster(cluster)
    else:
        configure_sharded_cluster(cluster)
Esempio n. 3
0
def configure_sharded_cluster_command(parsed_options):
    cluster_id = parsed_options.cluster
    cluster = repository.lookup_and_validate_cluster(cluster_id)

    if not isinstance(cluster, ShardedCluster):
        raise MongoctlException("Cluster '%s' is not a ShardedCluster cluster" %
                                cluster.id)

    if parsed_options.dryRun:
        dry_run_configure_sharded_cluster(cluster)
    else:
        configure_sharded_cluster(cluster)
Esempio n. 4
0
def configure_cluster_command(parsed_options):
    cluster_id = parsed_options.cluster
    cluster = repository.lookup_and_validate_cluster(cluster_id)
    if not isinstance(cluster, ReplicaSetCluster):
        raise MongoctlException("Cluster '%s' is not a replicaset cluster" %
                                cluster.id)
    force_primary_server_id = parsed_options.forcePrimaryServer

    if parsed_options.dryRun:
        dry_run_configure_cluster(
            cluster, force_primary_server_id=force_primary_server_id)
    else:
        configure_cluster(cluster,
                          force_primary_server_id=force_primary_server_id)
Esempio n. 5
0
def configure_cluster_command(parsed_options):
    cluster_id = parsed_options.cluster
    cluster = repository.lookup_and_validate_cluster(cluster_id)
    if not isinstance(cluster, ReplicaSetCluster):
        raise MongoctlException("Cluster '%s' is not a replicaset cluster" %
                                cluster.id)
    force_primary_server_id = parsed_options.forcePrimaryServer

    if parsed_options.dryRun:
        dry_run_configure_cluster(cluster,
                                  force_primary_server_id=
                                  force_primary_server_id)
    else:
        configure_cluster(cluster,
                          force_primary_server_id=
                          force_primary_server_id)