backend/common/rhn_rpm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
New commits: commit cb1e1d3754c79ff4c7f71c5b9611608febb7e2c0 Author: Jan Pazdziora jpazdziora@redhat.com Date: Fri May 13 14:22:53 2011 +0200
698567 - give the transaction that we have to use to read the file header a sandbox database.
Ever since we've prevented Spacewalk from reading the rpm database with SELinux, it complains in the error_log:
error: cannot open Packages database in /var/lib/rpm
This workaround should give it a place to create its own database.
diff --git a/backend/common/rhn_rpm.py b/backend/common/rhn_rpm.py index 3cd1b26..631f220 100644 --- a/backend/common/rhn_rpm.py +++ b/backend/common/rhn_rpm.py @@ -202,7 +202,15 @@ def get_package_header(filename=None, file=None, fd=None): if not SHARED_TS: SHARED_TS = rpm.ts() SHARED_TS.setVSFlags(-1) - hdr = SHARED_TS.hdrFromFdno(file_desc) + + rpm.addMacro('_dbpath', '/var/cache/rhn/rhnpush-rpmdb') + try: + hdr = SHARED_TS.hdrFromFdno(file_desc) + rpm.delMacro('_dbpath') + except: + rpm.delMacro('_dbpath') + raise + if hdr is None: raise InvalidPackageError is_source = hdr[rpm.RPMTAG_SOURCEPACKAGE]