Bug 1185432 - Running rhn_reg fails with a TypeError exception
Summary: Running rhn_reg fails with a TypeError exception
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: rhn-client-tools
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-23 17:42 UTC by Bernd Zeimetz
Modified: 2015-01-26 09:35 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-01-26 09:35:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch from debian (1.12 KB, patch)
2015-01-24 09:37 UTC, Bernd Zeimetz
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Debian BTS 728365 0 None None None Never

Description Bernd Zeimetz 2015-01-23 17:42:38 UTC
Description of problem:

root@xxxx:~# rhnreg_ks --serverUrl=https://spacewalk.xxxxxx.org/XMLRPC --activationkey=1-6eeaef0e9e7b42e048d09fbdce7add50
An error has occurred:
<type 'exceptions.TypeError'>
See /var/log/up2date for more information


root@xxxx:~# cat /var/log/up2date
[...]
<type 'exceptions.TypeError'>: cannot marshal None unless allow_none is enabled



Please see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=728365 for a discussion of the bug.

Looking at
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=20;filename=params.txt;att=1;bug=728365

I think that for some reason 'installtime' is set to None for some packages, which results in the described error.
{'name': 'libavahi-client3', 'epoch': '', 'version': '0.6.31', 'release': '2', 'arch': 'amd64-deb', 'installtime': None}

Comment 1 Bernd Zeimetz 2015-01-23 18:02:18 UTC
After digging trough the code I found the installTime function in rhn-client-tools/src/up2date_client/debUtils.py:

def installTime(pkg_name):
    path = '/var/lib/dpkg/info/%s.list' % pkg_name
    if os.path.isfile(path):
       return os.path.getmtime(path)
    else:
       return None

which returns None if there is no .list file for a given package name.

Problem here is the multiarch implementation, without testing I think correct would be this:

def installTime(pkg_name, arch=None):
    paths = ['/var/lib/dpkg/info/%s.list' % (pkg_name,)]    
    if arch:
        paths.append('/var/lib/dpkg/info/%s:%s.list' % (pkg_name, arch))
    for path in paths:
        if os.path.isfile(path):
           return os.path.getmtime(path)
    return None


getInstalledPackageList needs to call installTime(pkg.name, pkg.installed.architecture) then.

Comment 2 Bernd Zeimetz 2015-01-24 09:37:27 UTC
Created attachment 983659 [details]
patch from debian

Comment 3 Miroslav Suchý 2015-01-26 09:35:18 UTC
Yes. This was fixed in
db80b5977366f73243ed7014c808c70c97959650
on Wed Jul 17 15:40:47 2013 +0200

And fixed in rhn-client-tools-2.0.1-1

I believe Bend that I sent you private email with tar.gz link and ask about new release of rhn-client-tools in Debian.

Here is recent tar.gz of new rhn-client-tools:
  https://fedorahosted.org/releases/s/p/spacewalk/rhn-client-tools-2.3.5.tar.gz
which would require recent rhnlib:
  https://fedorahosted.org/releases/s/p/spacewalk/rhnlib-2.5.72.tar.gz
Which I *hope* is enough.


Note You need to log in before you can comment on or make changes to this bug.