示例#1
0
def handle_restart_test_instance(response_encoder, parameters):
    if ISSUER_QUERY_KEY in parameters and INSTANCE_ID_QUERY_KEY in parameters:
        issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
        instance_id = parameters[INSTANCE_ID_QUERY_KEY]
        port_database = PortDatabase(CONF.PORT_DATABASE_FILE)
        configurations = port_database.get_configuration(issuer, instance_id)
        if not configurations:
            raise MissingConfigurations(
                "Failed to load the configuration for the given test instance",
                log_info="No configuration from test instance issuer: "
                         "%s instance_id: %s" % (issuer, instance_id),
                show_trace=False)
        port = port_database.get_port(issuer, instance_id)
        profile = configurations['behaviour']['profile']
        return restart_test_instance(instance_id, port, profile, response_encoder, configurations)
    return response_encoder.bad_request()
示例#2
0
def handle_restart_test_instance(response_encoder, parameters):
    if ISSUER_QUERY_KEY in parameters and INSTANCE_ID_QUERY_KEY in parameters:
        issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
        instance_id = parameters[INSTANCE_ID_QUERY_KEY]
        port_database = PortDatabase(CONF.PORT_DATABASE_FILE)
        configurations = port_database.get_configuration(issuer, instance_id)
        if not configurations:
            raise MissingConfigurations(
                "Failed to load the configuration for the given test instance",
                log_info="No configuration from test instance issuer: "
                         "%s instance_id: %s" % (issuer, instance_id),
                show_trace=False)
        port = port_database.get_port(issuer, instance_id)
        profile = configurations['behaviour']['profile']
        return restart_test_instance(instance_id, port, profile, response_encoder, configurations)
    return response_encoder.bad_request()
示例#3
0
def load_configuration_from_database(parameters):
    issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
    instance_id = parameters[INSTANCE_ID_QUERY_KEY]
    port_database = PortDatabase(CONF.PORT_DATABASE_FILE)
    configurations = port_database.get_configuration(issuer, instance_id)
    return configurations
示例#4
0
def load_configuration_from_database(parameters):
    issuer = remove_last_slash(parameters[ISSUER_QUERY_KEY])
    instance_id = parameters[INSTANCE_ID_QUERY_KEY]
    port_database = PortDatabase(CONF.PORT_DATABASE_FILE)
    configurations = port_database.get_configuration(issuer, instance_id)
    return configurations