James Antill wrote:
On Wed, 2007-06-13 at 15:15 -0400, Jeremy Katz wrote:
On Wed, 2007-06-13 at 14:52 -0400, Matthew Miller wrote:
On Wed, Jun 13, 2007 at 02:43:13PM -0400, Jeremy Katz wrote:
In some cases (especially on distro upgrades where you have to do
further updates after the fact), loading plugins can fail to load for
various reasons.  We should probably be tolerant of that and just not
load them.  What do people think of the attached?
Not to make things more difficult, but some plugins may be more vital than
others -- in some cases, running with a plugin disabled may really screw up
the system. (For example, protectbase.)
Yeah, that's what makes things hard...  but blowing up with a traceback
of ImportError is almost certainly the wrong failure mode.

 Personally, I can't think of any major cases[1] where a plugin is going
to be so important that it's better to not run yum at all.
 Even when you have edge cases like yum-security is broken, it's almost
certainly better to have "yum --security update -y" do a full update in
than to just fail and do nothing, even if it has a good error message.

How about making "failure mode" a
standard configuration option in the conf file for each plugin?
And then you get to "what if reading the conf file fails"?
Realistically, we just need to decide on a line and stick to it.  Either
a) Failure to load a plugin just disables the plugin
b) Failure to load a plugin aborts with a nice-ish error message

My patch is the former, partially because it's the easier thing to
implement but also because getting out of the latter case is still not
obvious or simple for end-users.

 The obvious candidate, for the second approach, would be something
like:

         try:
             module = imp.load_module(modname, fp, pathname, description)
+        except ImportError:
+            raise PluginYumExit('"%s" plugin failed to load; use --noplugins' 
% modname)

...but as I said, I think your approach is better.

[1] In theory it might be better to abort immediately, for query
commands like:
  yum --security list updates

...which is done on the cmd line, but even then it's fairly easy to see
what's gone wrong ... and someone running that from cron just before an
update will likely disagree.

------------------------------------------------------------------------

_______________________________________________
Yum-devel mailing list
Yum-devel@linux.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
My proposal is this one.

        try:
            module = imp.load_module(modname, fp, pathname, description)
       except ImportError:
           raise PluginYumExit('"%s" plugin failed to load; use 
--disableplugin' % modname)

--disableplugin=plugin name is a new feature added to current yum CVS Head.

The GUI's like pirut & yumex can catch the exception and ask the user what to 
do.
The CLI just bails out, with a message to the user to solve the issue. Maybe it 
should print the Stack trace so there is a way to
se what goes wrong in the plugin.

Tim




_______________________________________________
Yum-devel mailing list
Yum-devel@linux.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to