Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6354: do an explicit read from version file to avoid circular reference #3480

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions python/vyos/system/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
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
Expand Down Expand Up @@ -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

Expand Down
Loading