예제 #1
0
def test_get_actual_deployments(mock_get_deployments,):
    mock_get_deployments.return_value = utils.DeploymentsJson({
        'fake_service:paasta-b_cluster.b_instance': {
            'docker_image': 'this_is_a_sha',
        },
        'fake_service:paasta-a_cluster.a_instance': {
            'docker_image': 'this_is_a_sha',
        }
    })
    expected = {
        'a_cluster.a_instance': 'this_is_a_sha',
        'b_cluster.b_instance': 'this_is_a_sha',
    }

    actual = status.get_actual_deployments('fake_service')
    assert expected == actual
예제 #2
0
def test_get_actual_deployments(mock_get_deployments,):
    mock_get_deployments.return_value = utils.DeploymentsJson({
        'fake_service:paasta-b_cluster.b_instance': {
            'docker_image': 'this_is_a_sha',
        },
        'fake_service:paasta-a_cluster.a_instance': {
            'docker_image': 'this_is_a_sha',
        }
    })
    expected = {
        'a_cluster.a_instance': 'this_is_a_sha',
        'b_cluster.b_instance': 'this_is_a_sha',
    }

    actual = status.get_actual_deployments('fake_service')
    assert expected == actual
예제 #3
0
파일: info.py 프로젝트: ashwinaj/paasta
def get_deployments_strings(service):
    output = []
    try:
        deployments = get_actual_deployments(service)
    except NoDeploymentsAvailable:
        deployments = {}
    if deployments == {}:
        output.append(' - N/A: Not deployed to any PaaSTA Clusters')
    else:
        service_config = load_service_namespace_config(service, 'main')
        service_mode = service_config.get_mode()
        for cluster in deployments_to_clusters(deployments):
            if service_mode == "tcp":
                service_port = service_config.get('proxy_port')
                link = PaastaColors.cyan('%s://paasta-%s.yelp:%d/' % (service_mode, cluster, service_port))
            elif service_mode == "http":
                link = PaastaColors.cyan('%s://%s.paasta-%s.yelp/' % (service_mode, service, cluster))
            else:
                link = "N/A"
            output.append(' - %s (%s)' % (cluster, link))
    return output
예제 #4
0
def get_deployments_strings(service):
    output = []
    try:
        deployments = get_actual_deployments(service)
    except NoDeploymentsAvailable:
        deployments = {}
    if deployments == {}:
        output.append(' - N/A: Not deployed to any PaaSTA Clusters')
    else:
        service_config = load_service_namespace_config(service, 'main')
        service_mode = service_config.get_mode()
        for cluster in deployments_to_clusters(deployments):
            if service_mode == "tcp":
                service_port = service_config.get('proxy_port')
                link = PaastaColors.cyan('%s://paasta-%s.yelp:%d/' %
                                         (service_mode, cluster, service_port))
            elif service_mode == "http":
                link = PaastaColors.cyan('%s://%s.paasta-%s.yelp/' %
                                         (service_mode, service, cluster))
            else:
                link = "N/A"
            output.append(' - %s (%s)' % (cluster, link))
    return output