diff --git a/config.yaml b/config.yaml index 26bc6a4..01636d0 100644 --- a/config.yaml +++ b/config.yaml @@ -43,4 +43,9 @@ options: type: string default: distributed description: | - Tunnel learning + connector type + pip-proxy: + type: string + default: None + description: | + Enables to install python modules behind a proxy diff --git a/hooks/neutron_plumgrid_utils.py b/hooks/neutron_plumgrid_utils.py index 4372113..24f3be5 100644 --- a/hooks/neutron_plumgrid_utils.py +++ b/hooks/neutron_plumgrid_utils.py @@ -7,12 +7,10 @@ from collections import OrderedDict from copy import deepcopy import os import subprocess -from subprocess import check_call import neutron_plumgrid_context from charmhelpers.contrib.openstack import templating from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute from charmhelpers.contrib.python.packages import pip_install -from charmhelpers.contrib.python.packages import apt_install from charmhelpers.fetch import ( apt_cache ) @@ -61,6 +59,7 @@ BASE_RESOURCE_MAP = OrderedDict([ NETWORKING_PLUMGRID_VERSION = OrderedDict([ ('kilo', '2015.1.1.1'), ('liberty', '2015.2.1.1'), + ('mitaka', '2016.1.1.1'), ]) @@ -82,10 +81,6 @@ def determine_packages(): "Build version '%s' for package '%s' not available" \ % (tag, pkg) raise ValueError(error_msg) - cmd = ['mkdir', '-p', '/etc/neutron/plugins/plumgrid'] - check_call(cmd) - cmd = ['touch', '/etc/neutron/plugins/plumgrid/plumgrid.ini'] - check_call(cmd) return pkgs @@ -157,17 +152,14 @@ def install_networking_plumgrid(): ''' release = os_release('neutron-common', base='kilo') if config('networking-plumgrid-version') is None: - #error point..."KeyError: 'mitaka'"...no net_pg_version for mitaka - #package_version = NETWORKING_PLUMGRID_VERSION[release] - print "######### install_networking_pg()" + package_version = NETWORKING_PLUMGRID_VERSION[release] else: package_version = config('networking-plumgrid-version') - #package_name = 'networking-plumgrid==%s' % package_version - #pip_install(package_name, fatal=True) - apt_install("git") - pip_install("git+https://github.com/openstack/networking-plumgrid.git", fatal=True) - if is_leader(): - # and package_version != '2015.1.1.1': + package_name = 'networking-plumgrid==%s' % package_version + pip_install(package_name, fatal=True, + proxy=(config('pip-proxy') if + config('pip-proxy') else None)) + if is_leader() and package_version != '2015.1.1.1': migrate_neutron_db() diff --git a/unit_tests/test_neutron_plumgrid_plugin_context.py b/unit_tests/test_neutron_plumgrid_plugin_context.py index 546b34e..91fa034 100644 --- a/unit_tests/test_neutron_plumgrid_plugin_context.py +++ b/unit_tests/test_neutron_plumgrid_plugin_context.py @@ -59,6 +59,7 @@ class NeutronPGContextTest(CharmTestCase): 'hardware-vendor-name': 'vendor_name', 'switch-username': 'plumgrid', 'switch-password': 'plumgrid', + 'connector-type': 'service', } def mock_config(key=None): @@ -88,6 +89,7 @@ class NeutronPGContextTest(CharmTestCase): 'switch_username': 'plumgrid', 'switch_password': 'plumgrid', 'metadata_mode': 'tunnel', + 'connector_type': 'service', 'nova_metadata_proxy_secret': 'plumgrid', 'pg_metadata_ip': '169.254.169.254', 'pg_metadata_subnet': '169.254.169.254/30',