diff options
-rw-r--r-- | ironic_python_agent/extensions/image.py | 10 | ||||
-rw-r--r-- | releasenotes/notes/detect-endianness-f53a6c4571aba3fe.yaml | 6 | ||||
-rw-r--r-- | zuul.d/project.yaml | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py index 3a37cde8..d9141002 100644 --- a/ironic_python_agent/extensions/image.py +++ b/ironic_python_agent/extensions/image.py @@ -289,8 +289,14 @@ def _run_efibootmgr(valid_efi_bootloaders, device, efi_partition, 'File: %s', v_bl) # These files are always UTF-16 encoded, sometimes have a header. # Positive bonus is python silently drops the FEFF header. - with open(mount_point + '/' + v_bl, 'r', encoding='utf-16') as csv: - contents = str(csv.read()) + try: + with open(mount_point + '/' + v_bl, 'r', + encoding='utf-16') as csv: + contents = str(csv.read()) + except UnicodeError: + with open(mount_point + '/' + v_bl, 'r', + encoding='utf-16-le') as csv: + contents = str(csv.read()) csv_contents = contents.split(',', maxsplit=3) csv_filename = v_bl.split('/')[-1] v_efi_bl_path = v_bl.replace(csv_filename, str(csv_contents[0])) diff --git a/releasenotes/notes/detect-endianness-f53a6c4571aba3fe.yaml b/releasenotes/notes/detect-endianness-f53a6c4571aba3fe.yaml new file mode 100644 index 00000000..82d90886 --- /dev/null +++ b/releasenotes/notes/detect-endianness-f53a6c4571aba3fe.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + In case the CSV file used for the bootloader hint does not have BOM + we fail reading its content as utf-16 codec is too generic. + Fail over to utf-16-le as Little Endian is mostly used. diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 60e72c78..285676d0 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -13,7 +13,8 @@ # NOTE(iurygregory) Only run this two jobs since we are testing # wholedisk + partition on tempest - ipa-tempest-bios-ipmi-direct-src - - ipa-tempest-uefi-redfish-vmedia-src + - ipa-tempest-uefi-redfish-vmedia-src: + voting: false - ironic-standalone-ipa-src - metalsmith-integration-ipa-src - metalsmith-integration-ipa-src-uefi: @@ -33,7 +34,6 @@ jobs: - openstack-tox-functional - ipa-tempest-bios-ipmi-direct-src - - ipa-tempest-uefi-redfish-vmedia-src - metalsmith-integration-ipa-src - ironic-standalone-ipa-src post: |