Bug 1687954
| Summary: | Index out of range in the buildah plugin, due to scratch container without an id. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Ryan Blakley <rblakley> |
| Component: | sos | Assignee: | Pavel Moravec <pmoravec> |
| Status: | CLOSED ERRATA | QA Contact: | Miroslav HradĂlek <mhradile> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.0 | CC: | agk, bmr, dornelas, gavin, jhunsaker, plambri, sbradley |
| Target Milestone: | rc | Keywords: | OtherQA |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | sos-3.7-1.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-11-05 22:32:24 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1186913 | ||
There is no need to collect buildah info about scratch containers? As we can also call there: brady = containah.split()[0] to identify the container by its ID. This will imho work also for scratch containers, but sosreport will name files with collected output like buildad_inspect_-t_container_e01b4c5a0d1c instead of having the container name there. Some preference between [0] and [-1] ? (In reply to Pavel Moravec from comment #1) > There is no need to collect buildah info about scratch containers? As we can > also call there: > > brady = containah.split()[0] > > to identify the container by its ID. This will imho work also for scratch > containers, but sosreport will name files with collected output like > > buildad_inspect_-t_container_e01b4c5a0d1c > > instead of having the container name there. > > Some preference between [0] and [-1] ? That's a good point the id would probably be better than the name since it will be unique. I also reached out to a container engineer to ask for their preference, and he confirmed the id would be better as well. As a FL sbr-containers engineer, I disagree that the ID is better here. We recently changed the docker and podman plugins to both use image names for '$thing inspect <image>' to visually differentiate them from '$thing inspect <container>' for suppoer engineers. In the buildah plugin we're already doing that, so I don't think we should change to not using names when we don't have to, since buildah already prevents duplicate-named containers. Using .split()[-1] is a better fix in my opinion. devel_ack+ for 8.1 Jake H. agreed to do OtherQE (thanks!). Jake, could you pls. verify the BZ against below build? Thanks in advance. A yum repository for the build of sos-3.7-1.el8 (task 22133742) is available at: http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/ You can install the rpms locally by putting this .repo file in your /etc/yum.repos.d/ directory: http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/sos-3.7-1.el8.repo RPMs and build logs can be found in the following locations: http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/noarch/ The full list of available rpms is: http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/noarch/sos-3.7-1.el8.src.rpm http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/noarch/sos-audit-3.7-1.el8.noarch.rpm http://brew-task-repos.usersys.redhat.com/repos/official/sos/3.7/1.el8/noarch/sos-3.7-1.el8.noarch.rpm Build output will be available for the next 21 days. Verified that sos-3.7-1 captures scratch container information correctly now and no error is thrown in plugin execution. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2019:3640 |
Description of problem: Index out of range in the buildah plugin, when there is a scratch built container. Version-Release number of selected component (if applicable): sos-3.6-10.el8.noarch Steps to Reproduce: 1. Run # buildah from scratch to create a scratch container. 2. Run # sosreport -o buildah Actual results: # cat sos_logs/buildah-plugin-errors.txt Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/sos/sosreport.py", line 1031, in setup plug.setup() File "/usr/lib/python3.6/site-packages/sos/plugins/buildah.py", line 39, in setup brady = containah.split()[4] IndexError: list index out of range # cat sos_commands/buildah/buildah_containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME e01b4c5a0d1c * a80dad1c1953 registry.redhat.io/rhel8-beta/rhel:latest rhel-working-container 7183139a0f71 * scratch working-container <<<---doesn't have an image id. Additional info: The below patch should fix the issue, since it will always be the last item in the array we can use -1 instead of determining the len and subtracting one. I tested with the below change, and it works perfect afterwards. root@ryan-rhel8 ~ # diff -up /usr/lib/python3.6/site-packages/sos/plugins/buildah.py.old /usr/lib/python3.6/site-packages/sos/plugins/buildah.py --- /usr/lib/python3.6/site-packages/sos/plugins/buildah.py.old 2019-03-12 12:41:21.364784851 -0400 +++ /usr/lib/python3.6/site-packages/sos/plugins/buildah.py 2019-03-12 12:41:30.208072777 -0400 @@ -36,7 +36,7 @@ class Buildah(Plugin, RedHatPlugin): if containahs['is_wicked_pissah']: for containah in containahs['auutput'].splitlines(): # obligatory Tom Brady - brady = containah.split()[4] + brady = containah.split()[-1] self.add_cmd_output('buildah inspect -t container %s' % brady) pitchez = make_chowdah('buildah images -n')