mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Wean off load_module
This commit is contained in:
parent
17a9837e36
commit
e57901290e
1 changed files with 4 additions and 16 deletions
|
@ -747,14 +747,8 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
spec = file_finder.find_spec(mod_namespace)
|
||||
if spec is None:
|
||||
raise ImportError()
|
||||
# TODO: Get rid of load_module in favor of
|
||||
# exec_module below. load_module is deprecated, but
|
||||
# loading using exec_module has been causing odd things
|
||||
# with the magic dunders we pack into the loaded
|
||||
# modules, most notably with salt-ssh's __opts__.
|
||||
mod = spec.loader.load_module()
|
||||
# mod = importlib.util.module_from_spec(spec)
|
||||
# spec.loader.exec_module(mod)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
# pylint: enable=no-member
|
||||
sys.modules[mod_namespace] = mod
|
||||
# reload all submodules if necessary
|
||||
|
@ -768,14 +762,8 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
)
|
||||
if spec is None:
|
||||
raise ImportError()
|
||||
# TODO: Get rid of load_module in favor of
|
||||
# exec_module below. load_module is deprecated, but
|
||||
# loading using exec_module has been causing odd things
|
||||
# with the magic dunders we pack into the loaded
|
||||
# modules, most notably with salt-ssh's __opts__.
|
||||
mod = self.run(spec.loader.load_module)
|
||||
# mod = importlib.util.module_from_spec(spec)
|
||||
# spec.loader.exec_module(mod)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
# pylint: enable=no-member
|
||||
sys.modules[mod_namespace] = mod
|
||||
except OSError:
|
||||
|
|
Loading…
Add table
Reference in a new issue