From 590b1723b5d70761dd14be132109173cfc1d9425 Mon Sep 17 00:00:00 2001 From: Alexander D Date: Fri, 18 May 2018 02:17:21 +0300 Subject: fix saltstack breakage introduced in v1.31.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SaltStack's openstack cloud provider in current production release calls os_client_config.vendors.get_profile after importing just os_client_config: https://github.com/saltstack/salt/blob/v2018.3.0/salt/cloud/clouds/openstack.py#L319 After 5c2eae8f8242332aff59d18b45a7d17f01524aaa vendors module is no longer imported into os_client_config which results in AttributeError: 'module' object has no attribute 'vendors' Importing this manually in __init__.py fixes it, however I wasn't able to write a working test case — testtools loader loads all submodules recursively and test runs without throwing exception. I hope someone more knowledgeable review this change and confirm it doesn't break this use case anymore. Thanks in advance. Change-Id: I5a3cb6096a090c29e257079da7c3d07d5a9b3428 Signed-off-by: Alexander D --- os_client_config/__init__.py | 1 + os_client_config/tests/test_import_vendors.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 os_client_config/tests/test_import_vendors.py diff --git a/os_client_config/__init__.py b/os_client_config/__init__.py index f5976b4..18cbca5 100644 --- a/os_client_config/__init__.py +++ b/os_client_config/__init__.py @@ -18,6 +18,7 @@ import pbr.version from os_client_config import cloud_config from os_client_config.config import OpenStackConfig # noqa +from os_client_config import vendors # noqa __version__ = pbr.version.VersionInfo('os_client_config').version_string() diff --git a/os_client_config/tests/test_import_vendors.py b/os_client_config/tests/test_import_vendors.py new file mode 100644 index 0000000..ba8800a --- /dev/null +++ b/os_client_config/tests/test_import_vendors.py @@ -0,0 +1,22 @@ +# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from os_client_config.tests import base + + +class TestImportVendors(base.TestCase): + + def test_get_profile(self): + import os_client_config # noqa + os_client_config.vendors.get_profile(profile_name="dummy") -- cgit v1.2.1