From c4b1acbdc41fbbb5c1631e795920136e34a04db0 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 12 Feb 2016 12:05:09 +0000 Subject: [PATCH] Resync helpers, fixup template header --- .../charmhelpers/contrib/openstack/neutron.py | 4 +++ hooks/charmhelpers/contrib/python/packages.py | 29 ++++++++++++++----- templates/mitaka/nova.conf | 2 +- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/hooks/charmhelpers/contrib/openstack/neutron.py b/hooks/charmhelpers/contrib/openstack/neutron.py index 9a8e0efc..dbc489ab 100644 --- a/hooks/charmhelpers/contrib/openstack/neutron.py +++ b/hooks/charmhelpers/contrib/openstack/neutron.py @@ -241,6 +241,10 @@ def neutron_plugins(): if midonet_origin is not None and midonet_origin[4:5] == '1': plugins['midonet']['driver'] = ( 'midonet.neutron.plugin_v1.MidonetPluginV2') + plugins['midonet']['server_packages'].remove( + 'python-neutron-plugin-midonet') + plugins['midonet']['server_packages'].append( + 'python-networking-midonet') return plugins diff --git a/hooks/charmhelpers/contrib/python/packages.py b/hooks/charmhelpers/contrib/python/packages.py index 8dcd6dd0..a2411c37 100644 --- a/hooks/charmhelpers/contrib/python/packages.py +++ b/hooks/charmhelpers/contrib/python/packages.py @@ -19,20 +19,35 @@ import os import subprocess +import sys from charmhelpers.fetch import apt_install, apt_update from charmhelpers.core.hookenv import charm_dir, log -try: - from pip import main as pip_execute -except ImportError: - apt_update() - apt_install('python-pip') - from pip import main as pip_execute - __author__ = "Jorge Niedbalski " +def pip_execute(*args, **kwargs): + """Overriden pip_execute() to stop sys.path being changed. + + The act of importing main from the pip module seems to cause add wheels + from the /usr/share/python-wheels which are installed by various tools. + This function ensures that sys.path remains the same after the call is + executed. + """ + try: + _path = sys.path + try: + from pip import main as _pip_execute + except ImportError: + apt_update() + apt_install('python-pip') + from pip import main as _pip_execute + _pip_execute(*args, **kwargs) + finally: + sys.path = _path + + def parse_options(given, available): """Given a set of options, check if available""" for key, value in sorted(given.items()): diff --git a/templates/mitaka/nova.conf b/templates/mitaka/nova.conf index 8e4bc98c..5371530b 100644 --- a/templates/mitaka/nova.conf +++ b/templates/mitaka/nova.conf @@ -1,4 +1,4 @@ -# kilo +# mitaka ############################################################################### # [ WARNING ] # Configuration file maintained by Juju. Local changes may be overwritten.