summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/libs
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-11-21 12:45:46 -0600
committerJohn Estabrook <jestabro@vyos.io>2022-11-21 15:03:54 -0600
commit3d4dedd6709760ebf7bb9cff2b1a22ab5b212532 (patch)
tree176934f50b9b1a34be6739c1b54e2065dccfc2b8 /src/services/api/graphql/libs
parent827f2b223d703539101c60e265b360c987d9c3da (diff)
downloadvyos-1x-3d4dedd6709760ebf7bb9cff2b1a22ab5b212532.tar.gz
vyos-1x-3d4dedd6709760ebf7bb9cff2b1a22ab5b212532.zip
graphql: T4544: use load_as_module from vyos.util
load_as_module was added to util.py for T4821; prefer over local copy
Diffstat (limited to 'src/services/api/graphql/libs')
-rw-r--r--src/services/api/graphql/libs/op_mode.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/services/api/graphql/libs/op_mode.py b/src/services/api/graphql/libs/op_mode.py
index 97a26520e..6939ed5d6 100644
--- a/src/services/api/graphql/libs/op_mode.py
+++ b/src/services/api/graphql/libs/op_mode.py
@@ -21,14 +21,9 @@ from typing import Union
from humps import decamelize
from vyos.defaults import directories
+from vyos.util import load_as_module
from vyos.opmode import _normalize_field_names
-def load_as_module(name: str, path: str):
- spec = importlib.util.spec_from_file_location(name, path)
- mod = importlib.util.module_from_spec(spec)
- spec.loader.exec_module(mod)
- return mod
-
def load_op_mode_as_module(name: str):
path = os.path.join(directories['op_mode'], name)
name = os.path.splitext(name)[0].replace('-', '_')