Page Menu
Home
VyOS Platform
Search
Configure Global Search
Log In
Files
F117520098
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
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
@@ -1,45 +1,38 @@
#!/usr/bin/env python3
#
# Copyright (C) 2022 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
import os
import sys
import json
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)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Sep 26, 9:00 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4277872
Default Alt Text
(1 KB)
Attached To
Mode
rVYOSONEX vyos-1x
Attached
Detach File
Event Timeline
Log In to Comment