diff options
author | John Estabrook <jestabro@vyos.io> | 2024-09-30 20:40:02 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-09-30 21:56:06 -0500 |
commit | 7e23fd9da028b3c623b69fda8a6bcfd887f1c18c (patch) | |
tree | b3b4e32a845f7635a1107feaa6a287eb9121818f /src/services/api/graphql/session/session.py | |
parent | 40d966310cb5d8d758f7fa801facd0a560795783 (diff) | |
download | vyos-1x-7e23fd9da028b3c623b69fda8a6bcfd887f1c18c.tar.gz vyos-1x-7e23fd9da028b3c623b69fda8a6bcfd887f1c18c.zip |
http-api: T6736: normalize formatting
Diffstat (limited to 'src/services/api/graphql/session/session.py')
-rw-r--r-- | src/services/api/graphql/session/session.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/services/api/graphql/session/session.py b/src/services/api/graphql/session/session.py index 6e2875f3c..619534f43 100644 --- a/src/services/api/graphql/session/session.py +++ b/src/services/api/graphql/session/session.py @@ -28,34 +28,45 @@ from api.graphql.libs.op_mode import normalize_output op_mode_include_file = os.path.join(directories['data'], 'op-mode-standardized.json') -def get_config_dict(path=[], effective=False, key_mangling=None, - get_first_key=False, no_multi_convert=False, - no_tag_node_value_mangle=False): + +def get_config_dict( + path=[], + effective=False, + key_mangling=None, + get_first_key=False, + no_multi_convert=False, + no_tag_node_value_mangle=False, +): config = Config() - return config.get_config_dict(path=path, effective=effective, - key_mangling=key_mangling, - get_first_key=get_first_key, - no_multi_convert=no_multi_convert, - no_tag_node_value_mangle=no_tag_node_value_mangle) + return config.get_config_dict( + path=path, + effective=effective, + key_mangling=key_mangling, + get_first_key=get_first_key, + no_multi_convert=no_multi_convert, + no_tag_node_value_mangle=no_tag_node_value_mangle, + ) + def get_user_info(user): user_info = {} - info = get_config_dict(['system', 'login', 'user', user], - get_first_key=True) + info = get_config_dict(['system', 'login', 'user', user], get_first_key=True) if not info: - raise ValueError("No such user") + raise ValueError('No such user') user_info['user'] = user user_info['full_name'] = info.get('full-name', '') return user_info + class Session: """ Wrapper for calling configsession functions based on GraphQL requests. Non-nullable fields in the respective schema allow avoiding a key check in 'data'. """ + def __init__(self, session, data): self._session = session self._data = data |