diff options
author | Stuart Mackie <wsmackie@juniper.net> | 2017-03-23 06:19:54 -0700 |
---|---|---|
committer | Stuart Mackie <wsmackie@juniper.net> | 2017-03-23 06:19:54 -0700 |
commit | 88df88a19674ccc0017836941b8ee32eaadf19fb (patch) | |
tree | f930c90f75846ec8d8e33cf27325ff8fafc85d5c /charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py | |
parent | 9f50a40437477432a21b326b15c343ca6b8fe516 (diff) |
Deleted charms with wrong license. Will source them differently in future.
Change-Id: I0fc99ea03c6b6ca4701e63793cb2be60e56c7588
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py')
-rw-r--r-- | charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py b/charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py deleted file mode 100644 index 034f7fe..0000000 --- a/charms/trusty/neutron-api-contrail/hooks/neutron_api_contrail_utils.py +++ /dev/null @@ -1,59 +0,0 @@ -from socket import gethostbyname -from subprocess import CalledProcessError, check_output - -import apt_pkg -from apt_pkg import version_compare - -from charmhelpers.core.hookenv import ( - related_units, - relation_get, - relation_ids -) - -from charmhelpers.core.templating import render - -apt_pkg.init() - -def dpkg_version(pkg): - try: - return check_output(["dpkg-query", "-f", "${Version}\\n", "-W", pkg]).rstrip() - except CalledProcessError: - return None - -CONTRAIL_VERSION = dpkg_version("contrail-config-openstack") -OPENSTACK_VERSION = dpkg_version("neutron-server") - -def contrail_api_ctx(): - ctxs = [ { "api_server": vip if vip \ - else gethostbyname(relation_get("private-address", unit, rid)), - "api_port": port } - for rid in relation_ids("contrail-api") - for unit, port, vip in - ((unit, relation_get("port", unit, rid), relation_get("vip", unit, rid)) - for unit in related_units(rid)) - if port ] - return ctxs[0] if ctxs else {} - -def identity_admin_ctx(): - ctxs = [ { "auth_host": gethostbyname(hostname), - "auth_port": relation_get("service_port", unit, rid), - "admin_user": relation_get("service_username", unit, rid), - "admin_password": relation_get("service_password", unit, rid), - "admin_tenant_name": relation_get("service_tenant_name", unit, rid) } - for rid in relation_ids("identity-admin") - for unit, hostname in - ((unit, relation_get("service_hostname", unit, rid)) for unit in related_units(rid)) - if hostname ] - return ctxs[0] if ctxs else {} - -def write_plugin_config(): - ctx = {} - ctx.update(contrail_api_ctx()) - ctx.update(identity_admin_ctx()) - if version_compare(OPENSTACK_VERSION, "1:2015.1~") >= 0: - ctx["authtoken"] = True - if version_compare(OPENSTACK_VERSION, "2:7.0.0") >= 0: - ctx["authtoken_creds"] = True - render("ContrailPlugin.ini", - "/etc/neutron/plugins/opencontrail/ContrailPlugin.ini", - ctx, "root", "neutron", 0440) |