Example #1
0
def get_port(username, project_name, service_name):
    cip = database_update.service_ip(username, project_name, service_name)
    if cip == '-':
        return 'no such project or service'

    cli = Client(base_url=cip, version=config.c_version)
    full_name = username + config.split_mark + project_name + config.split_mark + service_name

    if container_exists(cli, full_name):
        detail = cli.inspect_container(full_name)
        return detail['NetworkSettings']['Ports']
    else:
        return 'no such container'
Example #2
0
def get_status(username, password, project_name, service_name):
    cip = database_update.service_ip(username, project_name, service_name)
    if cip == '-':
        return 'no such project or service'

    cli = Client(cip, config.c_version)
    full_name = service_name + config.split_mark + project_name + config.split_mark + username
    # full_name = username + config.split_mark + project_name + config.split_mark + service_name

    if container_exists(cli, full_name):
        detail = cli.inspect_container(full_name)
        return detail['State']['Status']
    else:
        return 'no such container'
Example #3
0
def get_project_service(username, project_name):
    services = []

    service_name = service_name_list(username, project_name)

    if service_name is None:
        return None

    for service in service_name:
        ip = database_update.service_ip(username, project_name, service[0])
        item = {"name": service[0] + config.split_mark + project_name + config.split_mark + username, "ip": ip}
        services.append(item)

    return services