def register_configs():
    """
    Register config files with their respective contexts.
    Regstration of some configs may not be required depending on
    existing of certain relations.
    """
    # if called without anything installed (eg during install hook)
    # just default to earliest supported release. configs dont get touched
    # till post-install, anyway.
    release = get_os_codename_package('cinder-common', fatal=False) or 'folsom'
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)

    confs = []

    if relation_ids('ceph') and hook_name() != 'ceph-relation-broken':
        # Add charm ceph configuration to resources and
        # ensure directory actually exists
        mkdir(os.path.dirname(ceph_config_file()))
        mkdir(os.path.dirname(CEPH_CONF))
        # Install ceph config as an alternative for co-location with
        # ceph and ceph-osd charms - nova-compute ceph.conf will be
        # lower priority that both of these but thats OK
        if not os.path.exists(ceph_config_file()):
            # touch file for pre-templated generation
            open(ceph_config_file(), 'wt').close()
        install_alternative(os.path.basename(CEPH_CONF), CEPH_CONF,
                            ceph_config_file())
        CONFIG_FILES[ceph_config_file()] = {
            'hook_contexts':
            [context.CephContext(),
             cinder_contexts.CephAccessContext()],
            'services': ['cinder-volume'],
        }
        confs.append(ceph_config_file())

    for conf in confs:
        configs.register(conf, CONFIG_FILES[conf]['hook_contexts'])

    return configs
Example #2
0
         glance_contexts.LoggingConfigContext(),
         glance_contexts.GlanceIPv6Context(),
         context.WorkerConfigContext(),
         glance_contexts.MultiStoreContext(),
         context.OSConfigFlagContext(charm_flag='api-config-flags',
                                     template_flag='api_config_flags'),
         context.InternalEndpointContext('glance-common'),
         context.SubordinateConfigContext(interface=['storage-backend'],
                                          service=['glance-api'],
                                          config_file=GLANCE_API_CONF),
         context.MemcacheContext()
     ],
     '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()],
Example #3
0
         cinder_contexts.SectionalConfigContext(),
         cinder_contexts.LVMContext()
     ],
     'services':
     ['cinder-api', 'cinder-volume', 'cinder-scheduler', 'haproxy']
 }),
 (CINDER_API_CONF, {
     'contexts': [context.IdentityServiceContext()],
     'services': ['cinder-api'],
 }),
 (CINDER_POLICY_JSON, {
     'contexts': [],
     'services': ['cinder-api']
 }),
 (ceph_config_file(), {
     'contexts': [context.CephContext()],
     'services': ['cinder-volume']
 }),
 (HAPROXY_CONF, {
     'contexts': [
         context.HAProxyContext(singlenode_mode=True),
         cinder_contexts.HAProxyContext()
     ],
     'services': ['haproxy'],
 }),
 (APACHE_SITE_CONF, {
     'contexts': [cinder_contexts.ApacheSSLContext()],
     'services': ['apache2'],
 }),
 (APACHE_SITE_24_CONF, {
     'contexts': [cinder_contexts.ApacheSSLContext()],