def test_apache_ssl_context_service_enabled(self, mock_https,
                                                mock_config,
                                                mock_relation_ids):
        mock_relation_ids.return_value = []
        mock_config.return_value = 'true'
        mock_https.return_value = True

        ctxt = contexts.ApacheSSLContext()
        ctxt.enable_modules = MagicMock()
        ctxt.configure_cert = MagicMock()
        ctxt.configure_ca = MagicMock()
        ctxt.canonical_names = MagicMock()
        ctxt.get_network_addresses = MagicMock()
        ctxt.get_network_addresses.return_value = [('1.2.3.4', '1.2.3.4')]

        self.assertEqual(ctxt(), {'endpoints': [('1.2.3.4', '1.2.3.4',
                                                 9282, 9272)],
                                  'ext_ports': [9282],
                                  'namespace': 'glance'})
Exemplo n.º 2
0
        ],
        'services': ['glance-api']
    }),
    (ceph_config_file(), {
        'hook_contexts': [context.CephContext()],
        'services': ['glance-api', 'glance-registry']
    }),
    (HAPROXY_CONF, {
        'hook_contexts': [
            context.HAProxyContext(singlenode_mode=True),
            glance_contexts.HAProxyContext()
        ],
        'services': ['haproxy'],
    }),
    (HTTPS_APACHE_CONF, {
        'hook_contexts': [glance_contexts.ApacheSSLContext()],
        'services': ['apache2'],
    }),
    (HTTPS_APACHE_24_CONF, {
        'hook_contexts': [glance_contexts.ApacheSSLContext()],
        'services': ['apache2'],
    })
])


def register_configs():
    # Register config files with their respective contexts.
    # Regstration of some configs may not be required depending on
    # existing of certain relations.
    release = os_release('glance-common')
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,