Bug 507616 - traceback when installing cobbler
traceback when installing cobbler
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: distribution (Show other bugs)
All Linux
low Severity medium
: beta
: ---
Assigned To: Michael DeHaan
Daniel Riek
Depends On:
  Show dependency treegraph
Reported: 2009-06-23 09:54 EDT by Alexander Todorov
Modified: 2009-09-25 09:36 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-25 09:36:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alexander Todorov 2009-06-23 09:54:03 EDT
Description of problem:

Installing cobbler-1.6.2-1.fc11.noarch
/usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.py:30: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5
error: cannot open Packages index using db3 - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: cannot open Packages database in /var/lib/rpm

invalid literal for float(): n
  File "/usr/lib/python2.6/site-packages/cobbler/cobbler.py", line 83, in main
    rc = BootCLI().run(sys.argv)

  File "/usr/lib/python2.6/site-packages/cobbler/cobbler.py", line 45, in __init__
    self.api = api.BootAPI(is_cobblerd=False)

  File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 101, in __init__
    self.os_version = utils.os_release()

  File "/usr/lib/python2.6/site-packages/cobbler/utils.py", line 776, in os_release
    version = float(version[0])

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. @everything install
Actual results:

Expected results:

Additional info:
The DeprecationWarning is reported in bug #507614. It's no likely that they are duplicates.
Comment 2 Bill Nottingham 2009-06-23 12:51:42 EDT
Moving to releng. Do we have two cobbler packages in the tree???
Comment 3 Dennis Gregorovic 2009-06-23 13:25:01 EDT
The %post script is trying to call "rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE} --whatprovides redhat-release".  The call is failing somehow, leading to the traceback when it tries to parse the error message as an RPM version string.  Querying rpm from a %post script is not guaranteed to work. I would say this is a cobbler bug.
Comment 4 Mike McLean 2009-06-23 17:21:14 EDT
Calling rpm in a scriptlet is a big packaging no-no
Comment 5 Michael DeHaan 2009-06-24 14:50:36 EDT
I've never seen this happen in regular use with RPM or yum.

Any special Reproduction details?

AFAIK, this would be from condrestart in %post and that needing to check the package version, which has, so far, seemed to have worked.  That being said we could remove the condrestart and change it to a /stop/, though leaving the current version running is not a good idea.
Comment 6 Mike McLean 2009-06-24 15:21:59 EDT
calling rpm in a scriptlet will sometimes work -- basically there's racing between the rpm running the transaction and the rpm run inside the scriptlet. Note that they may be completely different versions of rpm (e.g. in the build system).

Regardless, calling rpm from a scriptlet should be avoided if at all possible.

Is there no other way to check the package version? Run a cli tool with -V? Look in an installed file?
Comment 7 Michael DeHaan 2009-06-24 15:27:55 EDT
In present versions, yes, we can in fact get it via safer means.

(Opening this up in Trac also so I don't lose track of this one).
Comment 8 Michael DeHaan 2009-06-24 15:28:53 EDT
Comment 9 Michael DeHaan 2009-09-25 09:36:32 EDT
Fixed in 2.0

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