mirror of https://github.com/veops/cmdb.git
feat(api): Replace imp with importlib
This commit is contained in:
parent
f24cb55585
commit
47332aca3c
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import imp
|
import importlib.util
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import jinja2
|
import jinja2
|
||||||
|
@ -198,11 +198,11 @@ class AttributeValueManager(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
path = script_f.name
|
path = script_f.name
|
||||||
dir_name, name = os.path.dirname(path), os.path.basename(path)[:-3]
|
name = os.path.basename(path)[:-3]
|
||||||
|
|
||||||
fp, path, desc = imp.find_module(name, [dir_name])
|
spec = importlib.util.spec_from_file_location(name, path)
|
||||||
|
mod = importlib.util.module_from_spec(spec)
|
||||||
mod = imp.load_module(name, fp, path, desc)
|
spec.loader.exec_module(mod)
|
||||||
|
|
||||||
if hasattr(mod, 'computed'):
|
if hasattr(mod, 'computed'):
|
||||||
return mod.computed()
|
return mod.computed()
|
||||||
|
|
Loading…
Reference in New Issue