def heat_plugin_joined(rel_id=None):
    utils.deploy_openstack_code("contrail-openstack-heat-init", "heat")

    plugin_path = utils.get_component_sys_paths(
        "heat") + "/vnc_api/gen/heat/resources"
    plugin_dirs = config.get("heat-plugin-dirs")
    if plugin_path not in plugin_dirs:
        plugin_dirs += ',' + plugin_path
    ctx = utils.get_context()
    sections = {
        "clients_contrail": [
            ("user", ctx.get("keystone_admin_user")),
            ("password", ctx.get("keystone_admin_password")),
            ("tenant", ctx.get("keystone_admin_tenant")),
            ("api_server", " ".join(ctx.get("api_servers"))),
            ("auth_host_ip", ctx.get("keystone_ip")),
            ("use_ssl", ctx.get("ssl_enabled")),
        ]
    }

    if ctx.get("ssl_enabled") and "ca_cert_data" in ctx:
        ca_file_path = "/etc/heat/contrail-ca-cert.pem"
        common_utils.save_file(ca_file_path, ctx["ca_cert_data"], perms=0o644)
        sections["clients_contrail"].append(("cafile", ca_file_path))

    conf = {"heat": {"/etc/heat/heat.conf": {"sections": sections}}}
    settings = {
        "plugin-dirs": plugin_dirs,
        "subordinate_configuration": json.dumps(conf)
    }
    relation_set(relation_id=rel_id, relation_settings=settings)
def write_configs():
    # don't need to write any configs for nova. only for neutron and heat.
    neutron = _is_related_to("neutron-api")
    heat = _is_related_to("heat")
    if not neutron and not heat:
        return

    ctx = get_context()

    keystone_ssl_ca = ctx.get("keystone_ssl_ca")
    path = "/etc/contrail/keystone/ssl/ca-cert.pem"
    common_utils.save_file(path, keystone_ssl_ca, perms=0o444)
    if keystone_ssl_ca:
        ctx["keystone_ssl_ca_path"] = path

    if neutron:
        if ctx.get("ssl_enabled") and "ca_cert_data" in ctx:
            common_utils.save_file('/etc/neutron/contrail-ca-cert.pem',
                                   ctx["ca_cert_data"],
                                   perms=0o644)
        render("ContrailPlugin.ini",
               "/etc/neutron/plugins/opencontrail/ContrailPlugin.ini", ctx,
               "root", "neutron", 0o440)
    # some code inside neutron-plugin/heat uses auth info from next file
    render("vnc_api_lib.ini", "/etc/contrail/vnc_api_lib.ini", ctx)
Ejemplo n.º 3
0
def render_config(ctx=None):
    if not ctx:
        ctx = get_context()

    # NOTE: store files in default paths cause no way to pass this path to
    # some of components (sandesh)
    ssl_ca = ctx["ssl_ca"]
    save_file("/etc/contrailctl/ssl/ca-cert.pem", ssl_ca)
    ssl_cert = ctx["ssl_cert"]
    save_file("/etc/contrailctl/ssl/server.pem", ssl_cert)
    ssl_key = ctx["ssl_key"]
    save_file("/etc/contrailctl/ssl/server-privkey.pem", ssl_key)

    render("analytics.conf", "/etc/contrailctl/analytics.conf", ctx)