Trevor Vaughan
2007-Jul-27 03:20 UTC
Small patch to take care of missing yum server problem.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I''ve created a small patch, below, to take care of the case when you wish to use yum to ensure that the latest version of the package is installed but the yum server is down. This patch makes the assumption that, in the case of an yum query error, you want to assume that, if the application is installed, it is the latest. This allows you to make sure that things are kept up to date when you want to require them for other parts of your manifest. Thanks, Trevor - -----BEGIN PATCH------ Index: lib/puppet/provider/package/yum.rb ==================================================================- --- lib/puppet/provider/package/yum.rb (revision 2726) +++ lib/puppet/provider/package/yum.rb (working copy) @@ -43,7 +43,12 @@ # What''s the latest package version available? def latest - - output = yum "-d", "0", "-e", "0", :list, :available, @resource[:name] + begin + output = yum "-d", "0", "-e", "0", :list, :available, @resource[:name] + rescue + output = "Notice:Yum server could not be reached." + Puppet::Util::Warnings.warnonce $output + end if output =~ /^#{Regexp.escape(@resource[:name])}\S+\s+(\S+)\s/ return $1 - -----END PATCH----- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGqWRhmiOKeJOeocsRCsOqAKCsWOrHM8UrgCwfcb2DjRGFR6WaCQCdFH0B NadAtAbCco7zQuu4pN2Wekk=HEhE -----END PGP SIGNATURE-----
Luke Kanies
2007-Jul-30 16:27 UTC
Re: Small patch to take care of missing yum server problem.
On Jul 26, 2007, at 10:20 PM, Trevor Vaughan wrote:> I''ve created a small patch, below, to take care of the case when you > wish to use yum to ensure that the latest version of the package is > installed but the yum server is down. > > This patch makes the assumption that, in the case of an yum query > error, > you want to assume that, if the application is installed, it is the > latest. > > This allows you to make sure that things are kept up to date when you > want to require them for other parts of your manifest.Thanks for the patch. Would you be willing to open a ticket with this patch attached? At the least, could you resend the patch as an attachment? It''s definitely preferred to add patches to tickets, since we can assign the appropriate person to look at them. And, of course, we don''t have to worry about line-wrapping. :) -- The Roman Rule The one who says it cannot be done should never interrupt the one who is doing it. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Trevor Vaughan
2007-Jul-30 17:29 UTC
Re: Small patch to take care of missing yum server problem.
Certainly. I''ll get it into a ticket as soon as I can (probably not until after 7pm or so). Trevor On 7/30/07, Luke Kanies <luke@madstop.com> wrote:> On Jul 26, 2007, at 10:20 PM, Trevor Vaughan wrote: > > > I''ve created a small patch, below, to take care of the case when you > > wish to use yum to ensure that the latest version of the package is > > installed but the yum server is down. > > > > This patch makes the assumption that, in the case of an yum query > > error, > > you want to assume that, if the application is installed, it is the > > latest. > > > > This allows you to make sure that things are kept up to date when you > > want to require them for other parts of your manifest. > > Thanks for the patch. > > Would you be willing to open a ticket with this patch attached? At > the least, could you resend the patch as an attachment? > > It''s definitely preferred to add patches to tickets, since we can > assign the appropriate person to look at them. And, of course, we > don''t have to worry about line-wrapping. :) > > -- > The Roman Rule > The one who says it cannot be done should never interrupt the > one who is doing it. > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
David Lutterkort
2007-Jul-30 18:08 UTC
Re: Small patch to take care of missing yum server problem.
Hi Trevor, On Thu, 2007-07-26 at 23:20 -0400, Trevor Vaughan wrote:> I''ve created a small patch, below, to take care of the case when you > wish to use yum to ensure that the latest version of the package is > installed but the yum server is down. > > This patch makes the assumption that, in the case of an yum query error, > you want to assume that, if the application is installed, it is the latest. > > This allows you to make sure that things are kept up to date when you > want to require them for other parts of your manifest.Thanks for sending the patch .. ideally, the reaction to an error would be more finegrained than just printing a warning, but given that it''s really hard to figure out why yum barfed on a command, that''s probably good enough for now. David