Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vyos/vyos-1x
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3f2668590b60f87606e95752f3eeeee781f663cc
Choose a base ref
..
head repository: vyos/vyos-1x
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2a28c1153612e43624f57628ee9d1c6d6c85b618
Choose a head ref
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/op_mode/image_installer.py
19 changes: 12 additions & 7 deletions src/op_mode/image_installer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
# Copyright 2023-2025 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This file is part of VyOS.
#
@@ -701,7 +701,7 @@ def is_raid_install(install_object: Union[disk.DiskDetails, raid.RaidDetails]) -
return False


def validate_compatibility(iso_path: str) -> None:
def validate_compatibility(iso_path: str, force: bool = False) -> None:
"""Check architecture and flavor compatibility with the running image
Args:
@@ -722,8 +722,9 @@ def validate_compatibility(iso_path: str) -> None:

if not old_flavor == new_flavor:
print(MSG_ERR_FLAVOR_MISMATCH.format(old_flavor, new_flavor))
cleanup()
exit(MSG_INFO_INSTALL_EXIT)
if not force:
cleanup()
exit(MSG_INFO_INSTALL_EXIT)


def install_image() -> None:
@@ -893,7 +894,7 @@ def install_image() -> None:

@compat.grub_cfg_update
def add_image(image_path: str, vrf: str = None, username: str = '',
password: str = '', no_prompt: bool = False) -> None:
password: str = '', no_prompt: bool = False, force: bool = False) -> None:
"""Add a new image
Args:
@@ -910,7 +911,7 @@ def add_image(image_path: str, vrf: str = None, username: str = '',
disk.partition_mount(iso_path, DIR_ISO_MOUNT, 'iso9660')

print('Validating image compatibility')
validate_compatibility(DIR_ISO_MOUNT)
validate_compatibility(DIR_ISO_MOUNT, force=force)

# check sums
print('Validating image checksums')
@@ -1031,6 +1032,9 @@ def parse_arguments() -> Namespace:
parser.add_argument('--image-path',
help='a path (HTTP or local file) to an image that needs to be installed'
)
parser.add_argument('--force', action='store_true',
help='Ignore flavor compatibility requirements.'
)
# parser.add_argument('--image_new_name', help='a new name for image')
args: Namespace = parser.parse_args()
# Validate arguments
@@ -1047,7 +1051,8 @@ def parse_arguments() -> Namespace:
install_image()
if args.action == 'add':
add_image(args.image_path, args.vrf,
args.username, args.password, args.no_prompt)
args.username, args.password,
args.no_prompt, args.force)

exit()