Bug 560341 - RFE: debuginfo-install doesn't catch PluginYumExit
RFE: debuginfo-install doesn't catch PluginYumExit
Product: Fedora
Classification: Fedora
Component: yum-utils (Show other bugs)
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-01-30 23:23 EST by Need Real Name
Modified: 2014-01-21 18:13 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-02-01 15:12:49 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
File: backtrace (1.26 KB, text/plain)
2010-01-30 23:23 EST, Need Real Name
no flags Details
File: comment (2.40 KB, text/plain)
2010-01-30 23:23 EST, Need Real Name
no flags Details

  None (edit)
Description Need Real Name 2010-01-30 23:23:52 EST
abrt 1.0.4 detected a crash.

architecture: x86_64
cmdline: /usr/bin/python /usr/bin/debuginfo-install digikam
Attached file: comment
component: yum-utils
executable: /usr/bin/debuginfo-install
package: yum-utils-1.1.25-1.fc12
release: Fedora release 12 (Constantine)

Summary: TBcf7be3c2 ibm-repository.py:103:init_hook:PluginYumExit: You need to be root to perform this command.

Traceback (most recent call last):
  File "/usr/bin/debuginfo-install", line 175, in <module>
    util = DebugInfoInstall()
  File "/usr/bin/debuginfo-install", line 56, in __init__
  File "/usr/bin/debuginfo-install", line 66, in main
    opts = self.doUtilConfigSetup()
  File "/usr/bin/debuginfo-install", line 60, in doUtilConfigSetup
    opts = YumUtilBase.doUtilConfigSetup(self, *args, **kwargs)
  File "/usr/share/yum-cli/utils.py", line 104, in doUtilConfigSetup
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 723, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 298, in _getConfig
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 177, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/ibm-repository.py", line 103, in init_hook
    raise PluginYumExit("You need to be root to perform this command.")
PluginYumExit: You need to be root to perform this command.

Local variables in innermost frame:
pc: <yum.plugins.InitPluginConduit instance at 0x1b35e60>

How to reproduce
1. run debuginfo-install digikam as non root user
Comment 1 Need Real Name 2010-01-30 23:23:55 EST
Created attachment 387806 [details]
File: backtrace
Comment 2 Need Real Name 2010-01-30 23:23:57 EST
Created attachment 387807 [details]
File: comment
Comment 3 Tim Lauridsen 2010-02-01 12:12:29 EST
The ibm-repository is an internal IBM plugin for adding internal IBM repositories. The plugin only only works as root.

As long as you are working we default Fedora packages you can add the '--noplugins' option to the command and it will work.

Else you have to to run all yum releated commands as root.
Comment 4 seth vidal 2010-02-01 14:00:43 EST
Adding a catch for that exit in utils.py is straightforward enough and kinda makes sense. I'll see if I can make it make sense.
Comment 5 seth vidal 2010-02-01 14:35:53 EST
upstream patch submitted to catch this error in utils.py so all of the yum-utils should get it.
Comment 6 seth vidal 2010-02-01 14:36:51 EST
diff --git a/utils.py b/utils.py
index dbbbe13..19a69db 100644
--- a/utils.py
+++ b/utils.py
@@ -195,8 +195,10 @@ class YumUtilBase(YumBaseCli):
         except ValueError, e:
             self.logger.critical(_('Options Error: %s'), e)
+        except plugins.PluginYumExit, e:
+            self.logger.critical(_('PluginExit Error: %s'), e)
+            sys.exit(1)
         # update usage in case plugins have added commands
Comment 7 Tim Lauridsen 2010-02-01 14:41:06 EST
Sounds good to me, but should a TYPE_CORE plugin use raise PluginYumExit at all ?
Comment 8 seth vidal 2010-02-01 14:48:28 EST
probably not - but that is neither here nor there, unfortunately.

catching the exception seems like a good idea in general.
Comment 9 Tim Lauridsen 2010-02-01 15:05:56 EST
Agree :)

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