diff --git a/doc/source/conf.py b/doc/source/conf.py index 5c41d69fa5..6d4c2d655c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -33,8 +33,9 @@ from oslo_config import cfg BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "..")) -CONTRIB_DIR = os.path.join(ROOT, 'contrib') -PLUGIN_DIRS = glob.glob(os.path.join(CONTRIB_DIR, '*')) +# TODO(tkajinam): Fix this +# CONTRIB_DIR = os.path.join(ROOT, 'contrib') +# PLUGIN_DIRS = glob.glob(os.path.join(CONTRIB_DIR, '*')) ENV_DIR = os.path.join(ROOT, "etc", "heat", "environment.d") TEMP_ENV_DIR = tempfile.mkdtemp() @@ -48,7 +49,7 @@ sys.path.insert(0, ROOT) sys.path.insert(0, BASE_DIR) cfg.CONF.import_opt('plugin_dirs', 'heat.common.config') -cfg.CONF.set_override(name='plugin_dirs', override=PLUGIN_DIRS) +# cfg.CONF.set_override(name='plugin_dirs', override=PLUGIN_DIRS) cfg.CONF.import_opt('environment_dir', 'heat.common.config') cfg.CONF.set_override(name='environment_dir', override=TEMP_ENV_DIR) diff --git a/heat/common/plugin_loader.py b/heat/common/plugin_loader.py index 90233742f3..7ea933d112 100644 --- a/heat/common/plugin_loader.py +++ b/heat/common/plugin_loader.py @@ -20,6 +20,7 @@ for them before loading them. """ import functools +import importlib.util import pkgutil import sys import types @@ -70,7 +71,8 @@ def _import_module(importer, module_name, package): if module_spec is None: return None - module = module_spec.loader.load_module(module_name) + module = importlib.util.module_from_spec(module_spec) + module_spec.loader.exec_module(module) # Make this accessible through the parent package for static imports local_name = module_name.partition(package.__name__ + '.')[2] diff --git a/heat/tests/test_environment.py b/heat/tests/test_environment.py index 6b1ab0b3a9..de39e157dc 100644 --- a/heat/tests/test_environment.py +++ b/heat/tests/test_environment.py @@ -12,7 +12,6 @@ # under the License. import os.path -import sys from unittest import mock import fixtures @@ -183,7 +182,6 @@ def constraint_mapping(): plugin_file = os.path.join(plugin_dir.path, 'test.py') with open(plugin_file, 'w+') as ef: ef.write(constraint_content) - self.addCleanup(sys.modules.pop, "heat.engine.plugins.test") cfg.CONF.set_override('plugin_dirs', plugin_dir.path) env = environment.Environment({}) @@ -202,7 +200,6 @@ def constraint_mapping(): plugin_file = os.path.join(plugin_dir.path, 'test.py') with open(plugin_file, 'w+') as ef: ef.write(constraint_content) - self.addCleanup(sys.modules.pop, "heat.engine.plugins.test") cfg.CONF.set_override('plugin_dirs', plugin_dir.path) env = environment.Environment({})