Example #1
0
def build_node_repr(name):
    """Build the representation of a node with peer and leader-election
    ports."""
    return '{}:{}:{}'.format(
        get_specific_host(get_service_name(), name),
        get_specific_port(get_service_name(), name, 'peer'),
        get_specific_port(get_service_name(), name, 'leader_election'))
Example #2
0
def build_node_repr(name):
    """Build the representation of a node with peer and leader-election
    ports."""
    return '{}:{}:{}'.format(
        get_specific_host(get_service_name(), name),
        get_specific_port(get_service_name(), name, 'peer'),
        get_specific_port(get_service_name(), name, 'leader_election'))
Example #3
0
def build_node_repr(name):
    """Build the representation of a node with peer and leader-election
    ports."""
    global conf
    raw_peer_type_env = '%s_%s_peer_type' % (get_service_name(), name)
    peer_type_env = raw_peer_type_env.replace('-', '_').upper()
    peer_type = os.environ.get(peer_type_env, None)

    if peer_type == 'observer':
        conf['peerType'] = 'observer'
        return '{}:{}:{}:observer'.format(
            get_specific_host(get_service_name(), name),
            get_specific_port(get_service_name(), name, 'peer'),
            get_specific_port(get_service_name(), name, 'leader_election'))
    else:
        return '{}:{}:{}'.format(
            get_specific_host(get_service_name(), name),
            get_specific_port(get_service_name(), name, 'peer'),
            get_specific_port(get_service_name(), name, 'leader_election'))
def getKafkaZookeeperNode(name):
    return '{}:{}'.format(
        get_specific_host('zookeeper', name),
        get_specific_port('zookeeper', name, 'client'))
Example #5
0
print 'get_port(name, default = )'
print orig.get_port('smtp')
print emap.get_port('smtp')

print 'get_node_list(service, ports=None)'
print orig.get_node_list('cassandra')
print emap.get_node_list('cassandra')
print orig.get_node_list('cassandra', ports = ['rpc'])
print emap.get_node_list('cassandra', ports = ['rpc'])

print 'get_specific_host(service, container)'
print orig.get_specific_host('cassandra', 'cassandra1')
print emap.get_specific_host('cassandra', 'cassandra1')

print 'get_specific_port(service, container, port,'
print orig.get_specific_port('cassandra', 'cassandra1', 'storage')
print emap.get_specific_port('cassandra', 'cassandra1', 'storage')

print 'get_specific_exposed_port'
try:
	print orig.get_specific_exposed_port('cassandra', 'cassandra1', 'storage')
except:
	print 'there wasnt one for cassandra'
print emap.get_specific_exposed_port('cassandra', 'cassandra1', 'storage')

try:
	print orig.get_specific_exposed_port('rails', 'rails1', 'smtp')
except:
	print 'there wasnt one for rails'
print emap.get_specific_exposed_port('rails', 'rails1', 'smtp')