Bug 560341 - RFE: debuginfo-install doesn't catch PluginYumExit
Summary: RFE: debuginfo-install doesn't catch PluginYumExit
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: yum-utils
Version: 12
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:cf7be3c2
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-31 04:23 UTC by Need Real Name
Modified: 2014-01-21 23:13 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-02-01 20:12:49 UTC
Type: ---
Embargoed:


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

Description Need Real Name 2010-01-31 04:23:52 UTC
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
kernel: 2.6.31.12-174.2.3.fc12.x86_64
package: yum-utils-1.1.25-1.fc12
release: Fedora release 12 (Constantine)

backtrace
-----
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__
    self.main()
  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
    self.conf
  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
    self.plugins.run('init')
  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
2. 
3.

Comment 1 Need Real Name 2010-01-31 04:23:55 UTC
Created attachment 387806 [details]
File: backtrace

Comment 2 Need Real Name 2010-01-31 04:23:57 UTC
Created attachment 387807 [details]
File: comment

Comment 3 Tim Lauridsen 2010-02-01 17:12:29 UTC
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 19:00:43 UTC
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 19:35:53 UTC
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 19:36:51 UTC
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)
             sys.exit(1)
-
-
+        except plugins.PluginYumExit, e:
+            self.logger.critical(_('PluginExit Error: %s'), e)
+            sys.exit(1)
+            
         # update usage in case plugins have added commands
         self._parser.set_usage(self._usage)

Comment 7 Tim Lauridsen 2010-02-01 19:41:06 UTC
Sounds good to me, but should a TYPE_CORE plugin use raise PluginYumExit at all ?

Comment 8 seth vidal 2010-02-01 19:48:28 UTC
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 20:05:56 UTC
Agree :)


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