Beispiel #1
0
def new_server(server_doc):
    _type = server_doc.get("_type")

    if _type is None or _type in SERVER_TYPE_MAP:
        clazz = resolve_class(SERVER_TYPE_MAP.get(_type,
                                                  MONGOD_SERVER_CLASS_NAME))
    else:
        raise MongoctlException("Unknown server _type '%s' for server:\n%s" %
                                (_type, document_pretty_string(server_doc)))

    return clazz(server_doc)
Beispiel #2
0
def new_server(server_doc):
    _type = server_doc.get("_type")

    if _type is None or _type in SERVER_TYPE_MAP:
        clazz = resolve_class(
            SERVER_TYPE_MAP.get(_type, MONGOD_SERVER_CLASS_NAME))
    else:
        raise MongoctlException("Unknown server _type '%s' for server:\n%s" %
                                (_type, document_pretty_string(server_doc)))

    return clazz(server_doc)
Beispiel #3
0
def new_server(server_doc):
    _type = server_doc.get("_type")

    if _type is None or _type == "mongod":
        server_type = "mongoctl.objects.mongod.MongodServer"
    elif _type == "mongos":
        server_type = "mongoctl.objects.mongos.MongosServer"
    else:
        raise MongoctlException("Unknown server _type '%s' for server:\n%s" %
                                (_type, document_pretty_string(server_doc)))

    clazz = resolve_class(server_type)
    return clazz(server_doc)
Beispiel #4
0
def new_server(server_doc):
    _type = server_doc.get("_type")

    if _type is None or _type == "mongod":
        server_type = "mongoctl.objects.mongod.MongodServer"
    elif _type == "mongos":
        server_type = "mongoctl.objects.mongos.MongosServer"
    else:
        raise MongoctlException("Unknown server _type '%s' for server:\n%s" %
                                (_type, document_pretty_string(server_doc)))

    clazz = resolve_class(server_type)
    return clazz(server_doc)
Beispiel #5
0
def sharded_cluster_type():
    return resolve_class("mongoctl.objects.sharded_cluster.ShardedCluster")
Beispiel #6
0
def replicaset_cluster_type():
    return resolve_class("mongoctl.objects.replicaset_cluster."
                         "ReplicaSetCluster")
Beispiel #7
0
def new_replicaset_cluster_member(cluster_mem_doc):
    mem_type = "mongoctl.objects.replicaset_cluster.ReplicaSetClusterMember"
    clazz = resolve_class(mem_type)
    return clazz(cluster_mem_doc)
Beispiel #8
0
def shardset_cluster_type():
    return resolve_class("mongoctl.objects.shardset_cluster.ShardSetCluster")
Beispiel #9
0
def replicaset_cluster_type():
    return resolve_class("mongoctl.objects.replicaset_cluster."
                         "ReplicaSetCluster")
Beispiel #10
0
def new_replicaset_cluster_member(cluster_mem_doc):
    mem_type = "mongoctl.objects.replicaset_cluster.ReplicaSetClusterMember"
    clazz = resolve_class(mem_type)
    return clazz(cluster_mem_doc)