I have found a few issues with puppet and the up2date provider (version 0.22.4) that I''d like to run by those who use up2date (to see if others are experiencing the same issues). 1. Puppet doesn''t seem to find the latest updates of packages that are already installed. In looking at "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb", I found that it''s calling "/usr/sbin/up2date-nox --show-available", but the --show-available option doesn''t list package updates for packages that are already installed. I think the only option that would work here is --showall as that will show the latest version of all packages available. 2. I don''t believe the package name matching is quite right. For example, if you have a package named "gv", it will also match "ggv". I think this can be fixed by changing: if output =~ /#{@model[:name]}-(\d+.*)\.\w+/ to if output =~ /^#{@model[:name]}-(\d+.*)\.\w+/ in "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb". 3. Finding the latest version of packages that are already installed can be quite time consuming if you''re doing a large number of packages. It''s currently calling "up2date-nox --show-available" for every package that it has to check. Couldn''t it just pull this list for the first package "latest" check and then reference that list for subsequent "latest" checks? If I''m correct on these, I *believe* they''re pretty trivial to correct. If so, I''ll look into writing a patch. Sorry if I should have posted this to the dev list instead, but I guess I''m looking to verify what I believe to be true first. Thanks, Jeremy
On May 30, 2007, at 12:07 PM, Jeremy Dreese wrote:> > I have found a few issues with puppet and the up2date provider > (version > 0.22.4) that I''d like to run by those who use up2date (to see if > others > are experiencing the same issues).Ok.> 1. Puppet doesn''t seem to find the latest updates of packages that are > already installed. In looking at > "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb", I found > that it''s calling "/usr/sbin/up2date-nox --show-available", but the > --show-available option doesn''t list package updates for packages that > are already installed. I think the only option that would work > here is > --showall as that will show the latest version of all packages > available.David Lutterkort or someone else who uses this will have to verify that; I have no idea.> 2. I don''t believe the package name matching is quite right. For > example, if you have a package named "gv", it will also match > "ggv". I > think this can be fixed by changing: > > if output =~ /#{@model[:name]}-(\d+.*)\.\w+/ > > to > > if output =~ /^#{@model[:name]}-(\d+.*)\.\w+/ > > in "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb".Ah. Fixed in SVN.> 3. Finding the latest version of packages that are already > installed can > be quite time consuming if you''re doing a large number of packages. > It''s currently calling "up2date-nox --show-available" for every > package > that it has to check. Couldn''t it just pull this list for the first > package "latest" check and then reference that list for subsequent > "latest" checks?Yes, this can and should be done; in fact, it should be done for all of the providers, not just up2date. The right way to do this is to add ''prefetch'' class methods that will run the one query and populate everything correctly. I''d be glad to work with you to get that done.> If I''m correct on these, I *believe* they''re pretty trivial to > correct. > If so, I''ll look into writing a patch. Sorry if I should have posted > this to the dev list instead, but I guess I''m looking to verify what I > believe to be true first.It''d be great to have these patches. -- A government big enough to give you everything you want is big enough to take from you everything you have. --Gerald R. Ford --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
>> 1. Puppet doesn''t seem to find the latest updates of packages that are >> already installed. In looking at >> "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb", I found >> that it''s calling "/usr/sbin/up2date-nox --show-available", but the >> --show-available option doesn''t list package updates for packages that >> are already installed. I think the only option that would work >> here is >> --showall as that will show the latest version of all packages >> available. >> > > David Lutterkort or someone else who uses this will have to verify > that; I have no idea. >Actually, I sort of found a way to verify it... from the up2date man page: --show-available List all packages available in the channels the server is subscribed to, but are not currently installed. --showall Show a list of all packages available from the channels the system is currently subscribed to, including those not currently installed.>> 3. Finding the latest version of packages that are already >> installed can >> be quite time consuming if you''re doing a large number of packages. >> It''s currently calling "up2date-nox --show-available" for every >> package >> that it has to check. Couldn''t it just pull this list for the first >> package "latest" check and then reference that list for subsequent >> "latest" checks? >> > > Yes, this can and should be done; in fact, it should be done for all > of the providers, not just up2date. > > The right way to do this is to add ''prefetch'' class methods that will > run the one query and populate everything correctly. I''d be glad to > work with you to get that done. >Yeah, I figured it needed done for other providers as well. Unfortunately, I currently only have up2date and yum based systems for testing, but I can at least work on those. I haven''t ever previously written a single line of ruby code so you might have to bear with me. The change is pretty easy to implement simply using a class variable, but that may not be the recommended/optimal way to do things... something like this in up2date.rb (v0.22.4): Puppet.type(:package).provide :up2date, :parent => :rpm do <snip> @@availablepackages = "" <snip> def latest if @@availablepackages == "" @@availablepackages = up2date "--showall" end if @@availablepackages =~ /^#{@model[:name]}-(\d+.*)\.\w+/ <snip> end As far as I can tell this seems to work, but if you can help me make this code a little more "ideal", that should be all there is to it (heh... or maybe that''s just wishful thinking on my part). Jeremy _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Wed, May 30, 2007 at 01:07:33PM -0400, Jeremy Dreese wrote:> > I have found a few issues with puppet and the up2date provider (version > 0.22.4) that I''d like to run by those who use up2date (to see if others > are experiencing the same issues). > > 1. Puppet doesn''t seem to find the latest updates of packages that are > already installed. In looking at > "/usr/lib/site_ruby/1.8/puppet/provider/package/up2date.rb", I found > that it''s calling "/usr/sbin/up2date-nox --show-available", but the > --show-available option doesn''t list package updates for packages that > are already installed. I think the only option that would work here is > --showall as that will show the latest version of all packages available.You are right --showall is correct.> 2. I don''t believe the package name matching is quite right. For > example, if you have a package named "gv", it will also match "ggv". I > think this can be fixed by changing: > > if output =~ /#{@model[:name]}-(\d+.*)\.\w+/ > > to > > if output =~ /^#{@model[:name]}-(\d+.*)\.\w+/Right again, I am not too happy with the regexp really but since we don''t have any control from the up2date output there isn''t much it can be done.> 3. Finding the latest version of packages that are already installed can > be quite time consuming if you''re doing a large number of packages. > It''s currently calling "up2date-nox --show-available" for every package > that it has to check. Couldn''t it just pull this list for the first > package "latest" check and then reference that list for subsequent > "latest" checks?This is how the yum provider works as well, we probably need a general solution for this. Kostas
On May 30, 2007, at 2:02 PM, Jeremy Dreese wrote:> > Actually, I sort of found a way to verify it... from the up2date > man page: > > --show-available > List all packages available in the channels > the server is subscribed to, but are not > currently installed. > --showall > Show a list of all packages available from the > channels > the system is currently subscribed to, including > those > not currently installed.Will that change the output format, or can the command just be switched?> Yeah, I figured it needed done for other providers as well. > Unfortunately, I currently only have up2date and yum based systems > for testing, but I can at least work on those. > > I haven''t ever previously written a single line of ruby code so you > might have to bear with me. The change is pretty easy to implement > simply using a class variable, but that may not be the recommended/ > optimal way to do things... something like this in up2date.rb > (v0.22.4): > > Puppet.type(:package).provide :up2date, :parent => :rpm do > <snip> > @@availablepackages = "" > <snip> > > def latest > if @@availablepackages == "" > @@availablepackages = up2date "--showall" > end > if @@availablepackages =~ /^#{@model[:name]}-(\d+.*)\.\w+/ > <snip> > end > > As far as I can tell this seems to work, but if you can help me > make this code a little more "ideal", that should be all there is > to it (heh... or maybe that''s just wishful thinking on my part).We should be able to rely on the ''list'' class method for packages -- it queries the package database, populating the providers as appropriate. Since I expect no one else knows that stuff (mostly because I foolishly haven''t documented it), I expect I''ll end up having to find the best way to do this. However, you could start with just implementing a ''list'' class method in the up2date provider, basing it off how the method works in rpm. You''ll still need to run the rpm list method, so get the current data, then run the up2date method to get the "latest" info. Something like this: def self.list super # call rpm.list ...now do something to get the latest values for all packages... ...and track the packages down and store the latest value in the provider... end I''ll have to make sure we have good methods for finding packages by name and storing these values appropriately. The class variable won''t work because it''s shared among subclasses, so, for instance, rpm and yum would be using the same variable. You could use a class instance variable, but you''d need to make sure it was cleaned up after every transaction, which isn''t currently possible; we''d have to add a hook to the transaction. -- Someday I want to be rich. Some people get so rich they lose all respect for humanity. That''s how rich I want to be. --Rita Rudner --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Luke Kanies wrote:> On May 30, 2007, at 2:02 PM, Jeremy Dreese wrote: > >> Actually, I sort of found a way to verify it... from the up2date >> man page: >> >> --show-available >> List all packages available in the channels >> the server is subscribed to, but are not >> currently installed. >> --showall >> Show a list of all packages available from the >> channels >> the system is currently subscribed to, including >> those >> not currently installed. >> > > Will that change the output format, or can the command just be switched? >The output''s the same so you should be able to just switch it. I''ve tried it here and it seems to work correctly.> We should be able to rely on the ''list'' class method for packages -- > it queries the package database, populating the providers as > appropriate. > > Since I expect no one else knows that stuff (mostly because I > foolishly haven''t documented it), I expect I''ll end up having to find > the best way to do this. However, you could start with just > implementing a ''list'' class method in the up2date provider, basing it > off how the method works in rpm. You''ll still need to run the rpm > list method, so get the current data, then run the up2date method to > get the "latest" info. Something like this: > > def self.list > super # call rpm.list > ...now do something to get the latest values for all packages... > ...and track the packages down and store the latest value in the > provider... > end > > I''ll have to make sure we have good methods for finding packages by > name and storing these values appropriately. >Thanks for the info. It may take me a bit to get to this due to the ruby learning curve (shouldn''t be too bad) and other normal work busyness. Assuming I get something for you to look at, I''ll post it to the dev list. Thanks, Jeremy _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On May 30, 2007, at 2:56 PM, Jeremy Dreese wrote:> The output''s the same so you should be able to just switch it. > I''ve tried it here and it seems to work correctly.Done. -- A Chemical Limerick: A mosquito cried out in pain: "A chemist has poisoned my brain!" The cause of his sorrow was para-dichloro diphenyltrichloroethane -- Dr. D. D. Perrin --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com