python encoding libs are missing in IPA ramdisk

Bug #2032981 reported by Illia Polliul
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironic-python-agent
Fix Released
Medium
Illia Polliul

Bug Description

Description of problem:

If you build IPA ramdisk with default parameters, it would be missing cp457 encoding file from python-libs. So if you try to run any Ansible against it it would result in a traceback like this:

Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1691401203.0476758-86670368828922/AnsiballZ_file.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1691401203.0476758-86670368828922/AnsiballZ_file.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1691401203.0476758-86670368828922/AnsiballZ_file.py", line 28, in invoke_module
    z = zipfile.ZipFile(modlib_path, mode='a')
  File "/usr/lib64/python3.9/zipfile.py", line 1286, in __init__
    self._RealGetContents()
  File "/usr/lib64/python3.9/zipfile.py", line 1371, in _RealGetContents
    filename = filename.decode('cp437')
LookupError: unknown encoding: cp437

We use IPA as a minimal operating system to run firmware updates, before the actual OpenStack rollout.
I understand that this is a niche use-case, but still would be nice to have it fixed.

Version-Release number of selected component (if applicable):
ironic-python-agent-builder==5.1.0

Additional info:
Also unzip package is missing, from baseos.

Missing Python encoding can probably be fixed in the python-libs package because it only includes a compiled .pyc version for this type of encoding, cp457. Some other encodings have source files.

So far my workaround is like this:

# This is required for Ansible to run on IPA, otherwise you recieve python zip errors
sed -i.bak '/^.*pyc/d' /usr/local/share/ironic-python-agent-builder/dib/ironic-ramdisk-base/cleanup.d/99-ramdisk-create
# unzip is missing in CentOS 9 base image
sed -i.bak '/^parted/a unzip:' /usr/local/share/ironic-python-agent-builder/dib/ironic-python-agent-ramdisk/package-installs.yaml

Changed in ironic:
status: New → In Progress
Revision history for this message
Jay Faulkner (jason-oldos) wrote :

This really impacts ironic-python-agent-builder; but we don't appear to have a launchpad bug project for that.

Changed in ironic:
status: In Progress → Confirmed
assignee: nobody → Illia Polliul (ipolliul)
importance: Undecided → Medium
affects: ironic → ironic-python-agent
Revision history for this message
Illia Polliul (ipolliul) wrote :

Unzip binary is needed for firmware binaries to run. It is not strictly related to ansible execution problem, but it is needed for a full use-case

Revision history for this message
Riccardo Pittau (rpittau) wrote :

unzip is not needed to run ipa, so you should use the package-installs element to add extra packages when creating your own build, so that's not really part of the bug
https://docs.openstack.org/diskimage-builder/latest/elements/package-installs/README.html

in theory the encodings dir is not strictly needed by ipa as well, but I can see a reasoning behind leaving it be; still not a bug, more like a corner case, w can probably accept not removing it by default

Illia Polliul (ipolliul)
Changed in ironic-python-agent:
status: Confirmed → Invalid
Revision history for this message
Illia Polliul (ipolliul) wrote :

While I don't disagree with your reasoning, practically it means that I need to leave one of two workarounds in place, to make work what was working for us before. Probably unzip was coming by default in centos-minimal 8 target, but this is impossible to build now, due to CentOS 8 EOL and migration to the stream model.

Changed in ironic-python-agent:
status: Invalid → Confirmed
Illia Polliul (ipolliul)
Changed in ironic-python-agent:
status: Confirmed → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic-python-agent-builder 5.2.0

This issue was fixed in the openstack/ironic-python-agent-builder 5.2.0 release.

Changed in ironic-python-agent:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.