Comment 0 for bug 388577

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

If the /var/lib/rpm directory exists on the system (this happens if
the "rpm" package is installed), the call to smart.initPlugins() in
landscape/package/facade.py makes the reporter crash with:

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "./landscape/package/reporter.py", line 52, in <lambda>
    result.addCallback(lambda x: self.request_unknown_hashes())
  File "./landscape/package/reporter.py", line 278, in request_unknown_hashes
    self.ensure_channels_reloaded()
  File "./landscape/package/taskhandler.py", line 30, in ensure_channels_reloaded
    self._facade.reload_channels()
  File "./landscape/package/facade.py", line 94, in reload_channels
    ctrl = self._get_ctrl()
  File "./landscape/package/facade.py", line 73, in _get_ctrl
    smart.initPlugins()
  File "/usr/lib/python2.6/dist-packages/smart/__init__.py", line 185, in initPlugins
    __import__("smart.plugins."+entry[:-3])
  File "/usr/lib/python2.6/dist-packages/smart/plugins/detectsys.py", line 66, in <module>
    detectRPMSystem()
  File "/usr/lib/python2.6/dist-packages/smart/plugins/detectsys.py", line 34, in detectRPMSystem
    "name": "RPM System"
  File "/usr/lib/python2.6/dist-packages/smart/sysconfig.py", line 226, in set
    self.assertWritable()
  File "/usr/lib/python2.6/dist-packages/smart/sysconfig.py", line 66, in assertWritable
    raise Error, _("Configuration is in readonly mode.")
Error: Configuration is in readonly mode.

Looking at the smart code shows that the problem is in plugins/detectsys.py:

def detectRPMSystem():
    dir = os.path.join(sysconf.get("rpm-root", "/"), "var/lib/rpm")
    if os.path.isdir(dir):
        for alias in sysconf.keys("channels"):
            if sysconf.get(("channels", alias, "type")) == "rpm-sys":
                break
        else:
            sysconf.set("channels.rpm-sys", {
                            "type": "rpm-sys",
                            "name": "RPM System"
                        })

because of the sysconf.set call in the else: branch.

 affects landscape-client
 importance medium
 milestone 1.3.2