diff --git a/hooks/nova_cc_utils.py b/hooks/nova_cc_utils.py index ac3b3101..239a5d00 100644 --- a/hooks/nova_cc_utils.py +++ b/hooks/nova_cc_utils.py @@ -205,7 +205,7 @@ APACHE_24_CONF = '/etc/apache2/sites-available/openstack_https_frontend.conf' def resolve_services(): _services = deepcopy(BASE_SERVICES) - os_rel = get_os_codename_install_source(config('openstack-origin')) + os_rel = os_release('nova-common') for release in SERVICE_BLACKLIST: if os_rel >= release: [_services.remove(service) diff --git a/unit_tests/test_actions.py b/unit_tests/test_actions.py index 9128c684..d09c0dc6 100644 --- a/unit_tests/test_actions.py +++ b/unit_tests/test_actions.py @@ -15,8 +15,9 @@ import mock with mock.patch('charmhelpers.core.hookenv.config') as config: - config.return_value = 'nova' - import nova_cc_utils as utils # noqa + with mock.patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): # noqa + config.return_value = 'nova' + import nova_cc_utils as utils # noqa # Need to do some early patching to get the module loaded. _reg = utils.register_configs diff --git a/unit_tests/test_actions_git_reinstall.py b/unit_tests/test_actions_git_reinstall.py index 7578f5e6..a9d69db7 100644 --- a/unit_tests/test_actions_git_reinstall.py +++ b/unit_tests/test_actions_git_reinstall.py @@ -24,13 +24,14 @@ sys.modules['apt_pkg'] = MagicMock() with patch('charmhelpers.contrib.hardening.harden.harden') as mock_dec: mock_dec.side_effect = (lambda *dargs, **dkwargs: lambda f: lambda *args, **kwargs: f(*args, **kwargs)) - with patch('nova_cc_utils.restart_map'): - with patch('nova_cc_utils.register_configs'): - with patch('nova_cc_utils.guard_map') as gmap: - with patch('charmhelpers.core.hookenv.config') as config: - config.return_value = False - gmap.return_value = {} - import git_reinstall + with patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): + with patch('nova_cc_utils.restart_map'): + with patch('nova_cc_utils.register_configs'): + with patch('nova_cc_utils.guard_map') as gmap: + with patch('charmhelpers.core.hookenv.config') as config: + config.return_value = False + gmap.return_value = {} + import git_reinstall from test_utils import CharmTestCase diff --git a/unit_tests/test_actions_openstack_upgrade.py b/unit_tests/test_actions_openstack_upgrade.py index f66fe000..fa47ad1b 100644 --- a/unit_tests/test_actions_openstack_upgrade.py +++ b/unit_tests/test_actions_openstack_upgrade.py @@ -18,8 +18,9 @@ from mock import patch, MagicMock os.environ['JUJU_UNIT_NAME'] = 'nova-cloud-controller' with patch('charmhelpers.core.hookenv.config') as config: - config.return_value = 'nova' - import nova_cc_utils as utils # noqa + with patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): + config.return_value = 'nova' + import nova_cc_utils as utils # noqa _reg = utils.register_configs _map = utils.restart_map diff --git a/unit_tests/test_nova_cc_contexts.py b/unit_tests/test_nova_cc_contexts.py index 1a91c0de..e6fa5702 100644 --- a/unit_tests/test_nova_cc_contexts.py +++ b/unit_tests/test_nova_cc_contexts.py @@ -18,7 +18,8 @@ import mock import nova_cc_context as context with mock.patch('charmhelpers.core.hookenv.config'): - import nova_cc_utils as _utils # noqa + with mock.patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): # noqa + import nova_cc_utils as _utils # noqa from charmhelpers.contrib.openstack import neutron from charmhelpers.contrib.openstack import utils diff --git a/unit_tests/test_nova_cc_hooks.py b/unit_tests/test_nova_cc_hooks.py index af74798e..c2623f69 100644 --- a/unit_tests/test_nova_cc_hooks.py +++ b/unit_tests/test_nova_cc_hooks.py @@ -21,8 +21,9 @@ from mock import MagicMock, patch, call from test_utils import CharmTestCase with patch('charmhelpers.core.hookenv.config') as config: - config.return_value = 'neutron' - import nova_cc_utils as utils + with patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): + config.return_value = 'neutron' + import nova_cc_utils as utils _reg = utils.register_configs _map = utils.restart_map diff --git a/unit_tests/test_nova_cc_utils.py b/unit_tests/test_nova_cc_utils.py index d725d20e..c9d2fc61 100644 --- a/unit_tests/test_nova_cc_utils.py +++ b/unit_tests/test_nova_cc_utils.py @@ -16,7 +16,8 @@ from collections import OrderedDict from mock import patch, MagicMock, call with patch('charmhelpers.core.hookenv.config'): - import nova_cc_utils as utils + with patch('charmhelpers.contrib.openstack.utils.get_os_codename_package'): # noqa + import nova_cc_utils as utils from test_utils import CharmTestCase, patch_open