diff options
| author | John Estabrook <jestabro@vyos.io> | 2022-07-29 12:14:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-29 12:14:13 -0500 |
| commit | 516b86bb970c7e039b58e554cb3b22e8f996841f (patch) | |
| tree | 9cd51989cd3fb03ca0d88c32cf0cc6d8c04bb892 /src/services/api/graphql/recipes/queries/system_status.py | |
| parent | b5d9ebf16f63b86013ce4e72a8023ac65fc2df8d (diff) | |
| parent | fa8dcff5d2e18ded5310d3f86ea0dc1bf2795af8 (diff) | |
| download | veeos-1x-516b86bb970c7e039b58e554cb3b22e8f996841f.tar.gz veeos-1x-516b86bb970c7e039b58e554cb3b22e8f996841f.zip | |
Merge pull request #1432 from jestabro/gql-op-mode
graphql: T4554: Automate GraphQL handling of standardized op-mode requests
Diffstat (limited to 'src/services/api/graphql/recipes/queries/system_status.py')
| -rwxr-xr-x | src/services/api/graphql/recipes/queries/system_status.py | 15 |
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) |
