summaryrefslogtreecommitdiff
path: root/src/services/api
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-07-24 15:08:56 -0500
committerJohn Estabrook <jestabro@vyos.io>2022-07-25 08:01:01 -0500
commit423485a0b87a650c74dd490a1335af969ef83237 (patch)
tree66c0617926411cb620997bf0d4fb6a9c8e28fcb0 /src/services/api
parent8f08891ecce805f34f698189050d9a39cddf5c32 (diff)
downloadvyos-1x-423485a0b87a650c74dd490a1335af969ef83237.tar.gz
vyos-1x-423485a0b87a650c74dd490a1335af969ef83237.zip
graphql: T4413: use util function for system_status.py
Diffstat (limited to 'src/services/api')
-rwxr-xr-xsrc/services/api/graphql/recipes/queries/system_status.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/services/api/graphql/recipes/queries/system_status.py b/src/services/api/graphql/recipes/queries/system_status.py
index 00c137443..8dadcc9f3 100755
--- a/src/services/api/graphql/recipes/queries/system_status.py
+++ b/src/services/api/graphql/recipes/queries/system_status.py
@@ -23,23 +23,16 @@ import importlib.util
from vyos.defaults import directories
-OP_PATH = directories['op_mode']
-
-def load_as_module(name: str):
- path = os.path.join(OP_PATH, name)
- spec = importlib.util.spec_from_file_location(name, path)
- mod = importlib.util.module_from_spec(spec)
- spec.loader.exec_module(mod)
- return mod
+from api.graphql.utils.util import load_op_mode_as_module
def get_system_version() -> dict:
- show_version = load_as_module('version.py')
+ show_version = load_op_mode_as_module('version.py')
return show_version.show(raw=True, funny=False)
def get_system_uptime() -> dict:
- show_uptime = load_as_module('show_uptime.py')
+ show_uptime = load_op_mode_as_module('show_uptime.py')
return show_uptime.get_raw_data()
def get_system_ram_usage() -> dict:
- show_ram = load_as_module('memory.py')
+ show_ram = load_op_mode_as_module('memory.py')
return show_ram.show(raw=True)