Skip to content

Commit

Permalink
Fixed grub verify_image_sign print
Browse files Browse the repository at this point in the history
  • Loading branch information
ycoheNvidia committed Jun 22, 2023
1 parent cb08153 commit 9b932e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sonic_installer/bootloader/grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/installer_bootloader_grub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9b932e7

Please sign in to comment.