diff --git a/sonic_installer/bootloader/grub.py b/sonic_installer/bootloader/grub.py index 4782c7d4d6..38321ce3e5 100644 --- a/sonic_installer/bootloader/grub.py +++ b/sonic_installer/bootloader/grub.py @@ -173,8 +173,8 @@ def is_secure_upgrade_image_verification_supported(self): fi exit 0 ''' - verification_result = subprocess.run(['bash', '-c', check_if_verification_is_enabled_and_supported_code], check=True, capture_output=True) - click.echo(str(verification_result.stdout) + " " + str(verification_result.stderr)) + verification_result = subprocess.run(['bash', '-c', check_if_verification_is_enabled_and_supported_code], check=True, capture_output=True, stderr=subprocess.STDOUT) + click.echo(verification_result.stdout.decode()) return verification_result.returncode == 0 def verify_image_sign(self, image_path): @@ -184,8 +184,8 @@ def verify_image_sign(self, image_path): if not os.path.exists(script_path): click.echo("Unable to find verification script in path " + script_path) return False - verification_result = subprocess.run([script_path, image_path], capture_output=True) - click.echo(str(verification_result.stdout) + " " + str(verification_result.stderr)) + verification_result = subprocess.run([script_path, image_path], capture_output=True, stderr=subprocess.STDOUT) + click.echo(verification_result.stdout.decode()) return verification_result.returncode == 0 @classmethod diff --git a/tests/installer_bootloader_grub_test.py b/tests/installer_bootloader_grub_test.py index bef6e63ce7..d418b76e55 100644 --- a/tests/installer_bootloader_grub_test.py +++ b/tests/installer_bootloader_grub_test.py @@ -93,6 +93,6 @@ def test_verify_image(): bootloader = grub.GrubBootloader() image = f'{grub.IMAGE_PREFIX}expeliarmus-{grub.IMAGE_PREFIX}abcde' - assert bootloader.is_secure_upgrade_image_verification_supported() + assert not bootloader.is_secure_upgrade_image_verification_supported() # command should fail assert not bootloader.verify_image_sign(image)