summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-05-18 07:27:58 -0500
committerGitHub <noreply@github.com>2024-05-18 07:27:58 -0500
commitef31f70256a2b835b406e76ca51dfb484f3d1b40 (patch)
tree8aeed15e791399f83588fafa89b2ae048eaad6c2
parentf612f8cf6e0e91c3322fb3c815b3e4702566e113 (diff)
parent31d3177019a553ca0279a439920bceac4bd0a95c (diff)
downloadvyos-1x-ef31f70256a2b835b406e76ca51dfb484f3d1b40.tar.gz
vyos-1x-ef31f70256a2b835b406e76ca51dfb484f3d1b40.zip
Merge pull request #3481 from vyos/mergify/bp/sagitta/pr-3480
T6354: do an explicit read from version file to avoid circular reference (backport #3480)
-rw-r--r--python/vyos/system/image.py10
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