summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-03-03 08:36:18 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-03-03 08:36:18 -0600
commit7ab3b9e021e7ce1c56b9f252a04400a37fd33e71 (patch)
tree4b8093d477b759850a2bb1339f30c7ce665a4591
parentbabff628aa9a48ced57100e3879232d94bf19d70 (diff)
downloadvyos-1x-7ab3b9e021e7ce1c56b9f252a04400a37fd33e71.tar.gz
vyos-1x-7ab3b9e021e7ce1c56b9f252a04400a37fd33e71.zip
graphql: T5040: use path from defaults
-rw-r--r--python/vyos/defaults.py1
-rwxr-xr-xsrc/services/api/graphql/generate/schema_from_composite.py2
-rwxr-xr-xsrc/services/api/graphql/generate/schema_from_config_session.py2
-rwxr-xr-xsrc/services/api/graphql/generate/schema_from_op_mode.py2
4 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py
index db0def8ed..060a0ba03 100644
--- a/python/vyos/defaults.py
+++ b/python/vyos/defaults.py
@@ -22,6 +22,7 @@ directories = {
'data' : '/usr/share/vyos/',
'conf_mode' : f'{base_dir}/conf_mode',
'op_mode' : f'{base_dir}/op_mode',
+ 'services' : f'{base_dir}/services',
'config' : '/opt/vyatta/etc/config',
'current' : '/opt/vyatta/etc/config-migrate/current',
'migrate' : '/opt/vyatta/etc/config-migrate/migrate',
diff --git a/src/services/api/graphql/generate/schema_from_composite.py b/src/services/api/graphql/generate/schema_from_composite.py
index d7b6e0035..50c5d24f8 100755
--- a/src/services/api/graphql/generate/schema_from_composite.py
+++ b/src/services/api/graphql/generate/schema_from_composite.py
@@ -26,7 +26,7 @@ from jinja2 import Template
from vyos.defaults import directories
if __package__ is None or __package__ == '':
- sys.path.append("/usr/libexec/vyos/services/api")
+ sys.path.append(os.path.join(directories['services'], 'api'))
from graphql.libs.op_mode import snake_to_pascal_case, map_type_name
from composite_function import queries, mutations
else:
diff --git a/src/services/api/graphql/generate/schema_from_config_session.py b/src/services/api/graphql/generate/schema_from_config_session.py
index f929e16b8..831faa41e 100755
--- a/src/services/api/graphql/generate/schema_from_config_session.py
+++ b/src/services/api/graphql/generate/schema_from_config_session.py
@@ -26,7 +26,7 @@ from jinja2 import Template
from vyos.defaults import directories
if __package__ is None or __package__ == '':
- sys.path.append("/usr/libexec/vyos/services/api")
+ sys.path.append(os.path.join(directories['services'], 'api'))
from graphql.libs.op_mode import snake_to_pascal_case, map_type_name
from config_session_function import queries, mutations
else:
diff --git a/src/services/api/graphql/generate/schema_from_op_mode.py b/src/services/api/graphql/generate/schema_from_op_mode.py
index 32f314c9b..98b2ad7b7 100755
--- a/src/services/api/graphql/generate/schema_from_op_mode.py
+++ b/src/services/api/graphql/generate/schema_from_op_mode.py
@@ -28,7 +28,7 @@ from vyos.defaults import directories
from vyos.opmode import _is_op_mode_function_name as is_op_mode_function_name
from vyos.util import load_as_module
if __package__ is None or __package__ == '':
- sys.path.append("/usr/libexec/vyos/services/api")
+ sys.path.append(os.path.join(directories['services'], 'api'))
from graphql.libs.op_mode import is_show_function_name
from graphql.libs.op_mode import snake_to_pascal_case, map_type_name
else: