Move feature plugin package installs to Python for image mode support#4800
Move feature plugin package installs to Python for image mode support#4800thrix wants to merge 1 commit intoissue-4606from
Conversation
There was a problem hiding this comment.
Code Review
This pull request transitions package installation for EPEL and FIPS features from Ansible playbooks to Python code to support image-mode guests with immutable filesystems. It also introduces distro_id and distro_major_version guest facts. Feedback suggests adding error handling for non-numeric VERSION_ID values during integer conversion to prevent potential crashes.
| def _query_distro_major_version(self, guest: 'Guest') -> Optional[int]: | ||
| version_id = self.os_release_content.get('VERSION_ID') | ||
| if version_id: | ||
| return int(version_id.split('.')[0]) |
There was a problem hiding this comment.
Handle non-numeric VERSION_ID values (e.g., 'rawhide') to avoid a ValueError during integer conversion. An explicit return None is included in the exception handler to maintain clarity, aligning with repository preferences for explicit returns.
| return int(version_id.split('.')[0]) | |
| try: | |
| return int(version_id.split('.')[0]) | |
| except ValueError: | |
| return None |
References
- An explicit return None at the end of a function may be preferred for clarity, even if it is considered unreachable by static analysis.
| else: | ||
| guest.package_manager.install(Package("dnf-command(config-manager)")) | ||
| # EPEL Next is available for CentOS Stream 9 | ||
| # Enable for Stream 10 once epel-next is available |
There was a problem hiding this comment.
| # Enable for Stream 10 once epel-next is available |
What? This would never happen. Seems like legacy comment
| if version == 9: | ||
| guest.package_manager.install(Package("epel-next-release")) | ||
|
|
||
| cls._run_playbook('enable', "epel-enable.yaml", guest, logger) |
There was a problem hiding this comment.
Is there value of keeping the remaining playbook?
Move package installations from Ansible playbooks to Python code using `guest.package_manager.install()` which works on both regular and image mode (bootc) guests. Playbooks now only handle `/etc` and `/var` mutations. Add `distro_id` and `distro_major_version` facts to `GuestFacts`. Fix FIPS `is_ostree` guard to allow image mode guests. Fixes #4625 Assisted-by: Claude Code Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
feef056 to
b9094a5
Compare
Move package installations from Ansible playbooks to Python code using
guest.package_manager.install()which works on both regular and image mode (bootc) guests. Playbooks now only handle/etcand/varmutations.Add
distro_idanddistro_major_versionfacts toGuestFacts.Fix FIPS
is_ostreeguard to allow image mode guests.Fixes #4625
Depends on #4719 which adds testing support for image mode.
Assisted-by: Claude Code
Pull Request Checklist