diff options
author | John Estabrook <jestabro@vyos.io> | 2024-05-17 11:56:50 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-05-17 12:15:49 -0500 |
commit | e0105ef380f1575613982f3b43c8ea3856654208 (patch) | |
tree | 39bd1f1800062bd3949fdf7438f8d1340b4fea4a /python/vyos/system/image.py | |
parent | 6b70110062190cae48770613d546ab89cb4c4de5 (diff) | |
download | vyos-1x-e0105ef380f1575613982f3b43c8ea3856654208.tar.gz vyos-1x-e0105ef380f1575613982f3b43c8ea3856654208.zip |
T6354: do an explicit read from version file to avoid circular reference
Diffstat (limited to 'python/vyos/system/image.py')
-rw-r--r-- | python/vyos/system/image.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/vyos/system/image.py b/python/vyos/system/image.py index ba9a6dfa7..aae52e770 100644 --- a/python/vyos/system/image.py +++ b/python/vyos/system/image.py @@ -18,8 +18,9 @@ from re import compile as re_compile from functools import wraps from tempfile import TemporaryDirectory from typing import TypedDict +from json import loads -from vyos import version +from vyos.defaults import directories from vyos.system import disk, grub # Define variables @@ -201,9 +202,12 @@ def get_running_image() -> str: if running_image_result: running_image: str = running_image_result.groupdict().get( 'image_version', '') - # we need to have a fallback for live systems + # we need to have a fallback for live systems: + # explicit read from version file if not running_image: - running_image: str = version.get_version() + json_data: str = Path(directories['data']).joinpath('version.json').read_text() + dict_data: dict = loads(json_data) + running_image: str = dict_data['version'] return running_image |