Description of problem: rlJournalStart fails to initialize journal on RHEL5. As a result, test programs which use beakerlib fail. Version-Release number of selected component (if applicable): beah-0.7.6-1.el5 beakerlib-1.9-4.el5 rpm-python-4.4.2.3-34.el5 How reproducible: Always Steps to Reproduce: Run this from shell: . /usr/share/beakerlib/beakerlib.sh rlJournalStart Actual results: # . /usr/share/beakerlib/beakerlib.sh # rlJournalStart Traceback (most recent call last): File "/usr/bin/beakerlib-journalling", line 861, in ? sys.exit(main()) File "/usr/bin/beakerlib-journalling", line 794, in main return Journal.initializeJournal(options.test, package) File "/usr/bin/beakerlib-journalling", line 397, in initializeJournal beakerlib_redhat_rpm = mi.next() StopIteration rlJournalStart: Failed to initialize the journal. Bailing out... Expected results: rlJournalStart should not crash. Additional info: Package "beakerlib-redhat" does not exist in our lab. The problem wasn't observed on newer distros (RHEL6, RHEL7). So this could be due to behavior change in rpm-python that the harness has to care about. # python Python 2.4.3 (#1, Oct 23 2012, 22:02:41) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import rpm >>> ts = rpm.ts() >>> mi = ts.dbMatch("name", "beakerlib") >>> print mi <rpm.mi object at 0x2b06cc618300> >>> print "%(name)s-%(version)s-%(release)s " % mi.next() beakerlib-1.9-4.el5 >>> mi = ts.dbMatch("name", "beakerlib-redhat") >>> print mi <rpm.mi object at 0x2b06cc6182d8> >>> print "%(name)s-%(version)s-%(release)s " % mi.next() Traceback (most recent call last): File "<stdin>", line 1, in ? StopIteration
Created attachment 938333 [details] a naive workaround patch Just in case, attached is a naive workaround. # . /usr/share/beakerlib/beakerlib.sh # rlJournalStart # rlJournalPrint ... <beakerlib_rpm> beakerlib-1.9-4.el5 </beakerlib_rpm> <beakerlib_redhat_rpm> not installed </beakerlib_redhat_rpm> ...
(In reply to Jun'ichi NOMURA from comment #0) > The problem wasn't observed on newer distros (RHEL6, RHEL7). > So this could be due to behavior change in rpm-python that the harness has > to care about. Yes, it looks like the rpm.mi type grew bool coercion in rpm 4.8.1 (RHEL6+): http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=9a93c9364d15cb569c6c9492be9ed992d28a3fc3 Easiest fix would be to just check the len() of the rpm.mi objects instead of relying on bool coercion. Patch to come.
Created attachment 939101 [details] patch Haven't verified this patch yet.
Actually I just found this patch which changes a len() to .count(), I guess because some (even older?) versions of RPM don't support len() on rpm.mi either? https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=f38e47bd18676b87db9aecbe878954b6896b569a
rpm.mi only added len() support in RPM 4.8.0 as well. http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=909982b1b5d2bccbf28ecfb38064ab86e09d4523
Created attachment 939109 [details] patch Second attempt at a patch, still haven't verified it. Corresponding test package is here: https://fedorapeople.org/~dcallagh/beakerlib-1.9-4.el5.bz1142535test.noarch.rpm
(In reply to Dan Callaghan from comment #6) > Corresponding test package is here: > https://fedorapeople.org/~dcallagh/beakerlib-1.9-4.el5.bz1142535test.noarch. > rpm Thanks, I tried the test package and it works for me. Except from journal.xml: <BEAKER_TEST> <test_id>1155290</test_id> <package>distribution</package> <pkgnotinstalled>distribution</pkgnotinstalled> <beakerlib_rpm>beakerlib-1.9-4.el5.bz1142535test </beakerlib_rpm> <beakerlib_redhat_rpm>not installed</beakerlib_redhat_rpm> ..
fixed by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?h=old-python&id=d6b190a12ef81058411033f8683fd7e35a13745e
beakerlib-1.9-5.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/beakerlib-1.9-5.el5
beakerlib-1.9-6.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/beakerlib-1.9-6.el5
beakerlib-1.10-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/beakerlib-1.10-1.el5
beakerlib-1.10-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.