Exemplo n.º 1
0
 def test_canonical_url_bare(self, is_clustered):
     '''It constructs a URL to host with no https or cluster present'''
     self.unit_get.return_value = 'foohost1'
     is_clustered.return_value = False
     configs = MagicMock()
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = []
     url = cluster_utils.canonical_url(configs)
     self.assertEquals('http://foohost1', url)
Exemplo n.º 2
0
 def test_canonical_url_https_cluster(self, is_clustered):
     '''It constructs a URL to host with https and cluster present'''
     self.config_get.return_value = '10.0.0.1'
     is_clustered.return_value = True
     configs = MagicMock()
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = ['https']
     url = cluster_utils.canonical_url(configs)
     self.assertEquals('https://10.0.0.1', url)
Exemplo n.º 3
0
def image_service_joined(relation_id=None):
    if not eligible_leader(CLUSTER_RES):
        return

    relation_data = {
        'glance-api-server': canonical_url(CONFIGS) + ":9292"
    }

    juju_log("%s: image-service_joined: To peer glance-api-server=%s" %
             (CHARM, relation_data['glance-api-server']))

    relation_set(relation_id=relation_id, **relation_data)
Exemplo n.º 4
0
def nova_vmware_relation_joined(rid=None):
    rel_settings = {'network_manager': network_manager()}

    ks_auth = _auth_config()
    if ks_auth:
        rel_settings.update(ks_auth)
        rel_settings.update({
            'quantum_plugin': neutron_plugin(),
            'quantum_security_groups': config('quantum-security-groups'),
            'quantum_url': (canonical_url(CONFIGS) + ':' +
                            str(api_port('neutron-server')))})

    relation_set(relation_id=rid, **rel_settings)
Exemplo n.º 5
0
def keystone_joined(relation_id=None):
    if not eligible_leader(CLUSTER_RES):
        juju_log('Deferring keystone_joined() to service leader.')
        return

    url = canonical_url(CONFIGS) + ":9292"
    relation_data = {
        'service': 'glance',
        'region': config('region'),
        'public_url': url,
        'admin_url': url,
        'internal_url': url, }

    relation_set(relation_id=relation_id, **relation_data)
Exemplo n.º 6
0
def identity_joined(rid=None):
    if not eligible_leader(CLUSTER_RES):
        return

    conf = config()

    port = conf['api-listening-port']
    url = canonical_url(CONFIGS) + ':%s/v1/$(tenant_id)s' % port

    settings = {
        'region': conf['region'],
        'service': 'cinder',
        'public_url': url,
        'internal_url': url,
        'admin_url': url,
    }
    relation_set(relation_id=rid, **settings)
Exemplo n.º 7
0
def keystone_compute_settings():
    ks_auth_config = _auth_config()
    rel_settings = {}

    if network_manager() in ['quantum', 'neutron']:
        if ks_auth_config:
            rel_settings.update(ks_auth_config)

        rel_settings.update({
            # XXX: Rename these relations settings?
            'quantum_plugin': neutron_plugin(),
            'region': config('region'),
            'quantum_security_groups': config('quantum-security-groups'),
            'quantum_url': (canonical_url(CONFIGS) + ':' +
                            str(api_port('neutron-server'))),
        })

    ks_ca = keystone_ca_cert_b64()
    if ks_auth_config and ks_ca:
        rel_settings['ca_cert'] = ks_ca

    return rel_settings
Exemplo n.º 8
0
def quantum_joined(rid=None):
    if not eligible_leader(CLUSTER_RES):
        return

    url = canonical_url(CONFIGS) + ':9696'
    # XXX: Can we rename to neutron_*?
    rel_settings = {
        'quantum_host': urlparse(url).hostname,
        'quantum_url': url,
        'quantum_port': 9696,
        'quantum_plugin': neutron_plugin(),
        'region': config('region')
    }

    # inform quantum about local keystone auth config
    ks_auth_config = _auth_config()
    rel_settings.update(ks_auth_config)

    # must pass the keystone CA cert, if it exists.
    ks_ca = keystone_ca_cert_b64()
    if ks_auth_config and ks_ca:
        rel_settings['ca_cert'] = ks_ca

    relation_set(relation_id=rid, **rel_settings)
Exemplo n.º 9
0
def identity_joined(rid=None):
    if not eligible_leader(CLUSTER_RES):
        return
    base_url = canonical_url(CONFIGS)
    relation_set(relation_id=rid, **determine_endpoints(base_url))