Jan
2011-Feb-11 11:31 UTC
[Puppet Users] Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
Hi *, we have plans to handle the update process of puppet related packages by our local update server. However, for now we need do deal with the situation by fetching the respective rpms to the client and install them by using the rpm provider. So in order to proceed with the installation I would like to check if the latest version is already installed before puppet tries to install/update it, to get rid of the following error log message: -----------------------------------<------------------------------------- node # puppetd -o --server puppet.domain.tld --waitforcert 60 --test [...] err: /Stage[main]/Puppet::Client::Rollout/Package[puppet]/ensure: change from 2.6.4-27.1 to Header-V3 failed: Could not update: Execution of ''/bin/rpm -U --oldpackage /tmp/puppet-2.6.4-27.1.x86_64.rpm'' returned 1: warning: /tmp/puppet-2.6.4-27.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 5c43a8d9 package puppet-2.6.4-27.1.x86_64 is already installed at /etc/puppet/manifests/classes/puppet.pp:42 [...] ----------------------------------->------------------------------------- This error occurs anytime if the latest version of the package is already installed. I tried to use the "onlyif" and "unless" parameters but according to the latest type reference under "http://docs.puppetlabs.com/references/latest/type.html" these seem to be not supported, neither by the resource type "file" nor by resource type "package". /etc/puppet/manifests/classes/puppet.pp ----------------------------------->------------------------------------- class puppet { class client { class rollout { $mypuppetversion = "2.6.4-27.1" $myfacterversion = "1.5.8-6.1" $myrshadowversion = "1.4.1-4.1" file { "/tmp/facter-$myfacterversion.x86_64.rpm": source => "puppet://puppet.domain.tld/files/rpm-sles11sp1/facter-$myfacterversion.x86_64.rpm"; "/tmp/puppet-$mypuppetversion.x86_64.rpm": source => "puppet://puppet.domain.tld/files/rpm-sles11sp1/puppet-$mypuppetversion.x86_64.rpm"; "/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm": source => "puppet://puppet.domain.tld/files/rpm-sles11sp1/ruby-shadow-$myrshadowversion.x86_64.rpm"; } package { "facter": ensure => latest, name => "facter", provider => rpm, source => "/tmp/facter-$myfacterversion.x86_64.rpm", require => file["/tmp/facter-$myfacterversion.x86_64.rpm"]; "puppet": ensure => latest, name => "puppet", provider => rpm, source => "/tmp/puppet-$mypuppetversion.x86_64.rpm", require => file["/tmp/puppet-$mypuppetversion.x86_64.rpm"]; "ruby-shadow": ensure => latest, name => "ruby-shadow", provider => rpm, source => "/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm", require => file["/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm"]; } service { "puppet": enable => true, ensure => running, restart => true, name => "puppet"; } } } } -----------------------------------<------------------------------------- I hope that somebody got the point because as every time I''m totally sure that I missed some peace of documentation and of course there is always a better way to handle such situations? :) Thanks in advance Jan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2011-Feb-11 18:40 UTC
Re: [Puppet Users] Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
On Feb 11, 2011, at 3:31 AM, Jan wrote:> Hi *, > > we have plans to handle the update process of puppet related packages by > our local update server. However, for now we need do deal with the > situation by fetching the respective rpms to the client and install them > by using the rpm provider. > > So in order to proceed with the installation I would like to check if > the latest version is already installed before puppet tries to > install/update it, to get rid of the following error log message: > > -----------------------------------<------------------------------------- > node # puppetd -o --server puppet.domain.tld --waitforcert 60 --test > [...] > err: /Stage[main]/Puppet::Client::Rollout/Package[puppet]/ensure: change > from 2.6.4-27.1 to Header-V3 failed: Could not update: Execution of > ''/bin/rpm -U --oldpackage /tmp/puppet-2.6.4-27.1.x86_64.rpm'' returned 1: > warning: /tmp/puppet-2.6.4-27.1.x86_64.rpm: Header V3 DSA signature: > NOKEY, key ID 5c43a8d9 > package puppet-2.6.4-27.1.x86_64 is already installed > at /etc/puppet/manifests/classes/puppet.pp:42 > [...] > ----------------------------------->------------------------------------- > > This error occurs anytime if the latest version of the package is > already installed. I tried to use the "onlyif" and "unless" parameters > but according to the latest type reference under > "http://docs.puppetlabs.com/references/latest/type.html" these seem to > be not supported, neither by the resource type "file" nor by resource > type "package".Well, it wouldn''t help you with the file since the problem is in the Package. 1) So, just some random advice. If you''re using the same server to serve files and catalogs, you can skip listing the server and just use 3 slashes like this: puppet:///files/rpm-sles11sp1/ruby-shadow-$myrshadowversion.x86_64.rpm 2) You sure it''s not easier to just create a repository right now instead? 3) What if you try using "ensure => installed" in the package? Does that work? 4) I assume you''re getting one of those errors for every package. Is that true?> > /etc/puppet/manifests/classes/puppet.pp > ----------------------------------->------------------------------------- > class puppet { > > class client { > > class rollout { > > $mypuppetversion = "2.6.4-27.1" > $myfacterversion = "1.5.8-6.1" > $myrshadowversion = "1.4.1-4.1" > > file { > "/tmp/facter-$myfacterversion.x86_64.rpm": > source => > "puppet://puppet.domain.tld/files/rpm-sles11sp1/facter-$myfacterversion.x86_64.rpm"; > "/tmp/puppet-$mypuppetversion.x86_64.rpm": > source => > "puppet://puppet.domain.tld/files/rpm-sles11sp1/puppet-$mypuppetversion.x86_64.rpm"; > "/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm": > source => > "puppet://puppet.domain.tld/files/rpm-sles11sp1/ruby-shadow-$myrshadowversion.x86_64.rpm"; > } > > package { > "facter": > ensure => latest, > name => "facter", > provider => rpm, > source => "/tmp/facter-$myfacterversion.x86_64.rpm", > require => file["/tmp/facter-$myfacterversion.x86_64.rpm"]; > "puppet": > ensure => latest, > name => "puppet", > provider => rpm, > source => "/tmp/puppet-$mypuppetversion.x86_64.rpm", > require => file["/tmp/puppet-$mypuppetversion.x86_64.rpm"]; > "ruby-shadow": > ensure => latest, > name => "ruby-shadow", > provider => rpm, > source => "/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm", > require => > file["/tmp/ruby-shadow-$myrshadowversion.x86_64.rpm"]; > } > > service { > "puppet": > enable => true, > ensure => running, > restart => true, > name => "puppet"; > } > > } > > } > > } > -----------------------------------<------------------------------------- > > I hope that somebody got the point because as every time I''m totally > sure that I missed some peace of documentation and of course there is > always a better way to handle such situations? :) > > Thanks in advance > Jan > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jan
2011-Feb-11 21:24 UTC
Re: [Puppet Users] Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
Hi Patrick, On 02/11/2011 07:40 PM, Patrick wrote: [...]> 1) So, just some random advice. If you''re using the same server to > serve files and catalogs, you can skip listing the server and just > use 3 slashes like this: > puppet:///files/rpm-sles11sp1/ruby-shadow-$myrshadowversion.x86_64.rpmI see but I''ve just added this during the debugging procedure of our nameservers, anyhow your advice is welcome :)> 2) You sure it''s not easier to just create a repository right now > instead?Of course and I would really like to but for the moment we''re facing some serious issues which won''t fix in time. Thats the major reason for me searching a temporary solution.> 3) What if you try using "ensure => installed" in the package? Does > that work?This won''t work because puppet (as of version 0.24.x) is already installed on all nodes. That''s the reason why I want puppet to upgrade the package _only_ if a newer version is available. When using "ensure => installed" the package won''t be upgraded because "some version" is already installed. However, I haven''t checked it by myself but I think that the same error message will be thrown if using "ensure => latest" on other packages, right? If yes, would you say that its a bug or a feature? ;) I want to get rid of that error message to keep the log files clean maybe to let them be checked on errors by our monitoring agent at a later time. The rest of the manifest seems to work just fine also with this error message coming up.> 4) I assume you''re getting one of those errors for every package. Is > that true?Yes, that''s correct. Jan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jan
2011-Feb-14 08:35 UTC
Re: [Puppet Users] Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
Hi *, no more ideas? :) Jan On 02/11/2011 10:24 PM, Jan wrote:> Hi Patrick, > > On 02/11/2011 07:40 PM, Patrick wrote: > > [...] > >> 1) So, just some random advice. If you''re using the same server to >> serve files and catalogs, you can skip listing the server and just >> use 3 slashes like this: >> puppet:///files/rpm-sles11sp1/ruby-shadow-$myrshadowversion.x86_64.rpm > > I see but I''ve just added this during the debugging procedure of our > nameservers, anyhow your advice is welcome :) > >> 2) You sure it''s not easier to just create a repository right now >> instead? > > Of course and I would really like to but for the moment we''re facing > some serious issues which won''t fix in time. Thats the major reason for > me searching a temporary solution. > >> 3) What if you try using "ensure => installed" in the package? Does >> that work? > > This won''t work because puppet (as of version 0.24.x) is already > installed on all nodes. That''s the reason why I want puppet to upgrade > the package _only_ if a newer version is available. When using "ensure > => installed" the package won''t be upgraded because "some version" is > already installed. > > However, I haven''t checked it by myself but I think that the same error > message will be thrown if using "ensure => latest" on other packages, > right? If yes, would you say that its a bug or a feature? ;) > > I want to get rid of that error message to keep the log files clean > maybe to let them be checked on errors by our monitoring agent at a > later time. The rest of the manifest seems to work just fine also with > this error message coming up. > >> 4) I assume you''re getting one of those errors for every package. Is >> that true? > > Yes, that''s correct. > > Jan >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2011-Feb-14 14:13 UTC
[Puppet Users] Re: Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
On Feb 14, 2:35 am, Jan <j...@agetty.de> wrote:> Hi *, > > no more ideas? :)Whenever you want to use information about the state of a node to influence the catalog supplied to that node, the Puppet Way is to use facts. In this case, it would need to be a custom fact. It wouldn''t be too hard to wrap a custom fact around `rpm -q puppet`, or even to draw a bunch of custom facts out of `rpm -qa`. HOWEVER, I have to second Patrick''s recommendation to create a local repository. Even a temporary one could solve the immediate problem until your major problems (whatever they are) are sorted. A yum repository, at least, is very easy to create, and very easy to advertise to all your clients via Puppet. You could set it up on your Puppetmaster, where evidently you already have copies of all the RPMs you want to distribute, and which all your clients can already reach over the network. Alternatively, you could abandon your Package resources in favor of Execs of the form "yum localinstall -y <RPM package>". That gets you out of creating either a repository or any custom facts, but it is furthest from the Way, and the most disruptive to your current manifests. Good Luck, John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Mike
2012-Mar-08 21:54 UTC
[Puppet Users] Re: Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
Why does puppet return an error when a package is already installed? I use ensure => installed to make sure that a package is installed, and then have a file that is dependent on that package. When the manifest is applied and the package is already installed, it reports an error and then doesn''t do anything with the file. Isn''t this a bug? The package type is just supposed to ensure that the package is installed. If it sees that it is already installed, that should be a good thing, not an error. On Monday, February 14, 2011 8:13:36 AM UTC-6, jcbollinger wrote:> > > > On Feb 14, 2:35 am, Jan <j...@agetty.de> wrote: > > Hi *, > > > > no more ideas? :) > > Whenever you want to use information about the state of a node to > influence the catalog supplied to that node, the Puppet Way is to use > facts. In this case, it would need to be a custom fact. It wouldn''t > be too hard to wrap a custom fact around `rpm -q puppet`, or even to > draw a bunch of custom facts out of `rpm -qa`. > > HOWEVER, I have to second Patrick''s recommendation to create a local > repository. Even a temporary one could solve the immediate problem > until your major problems (whatever they are) are sorted. A yum > repository, at least, is very easy to create, and very easy to > advertise to all your clients via Puppet. You could set it up on your > Puppetmaster, where evidently you already have copies of all the RPMs > you want to distribute, and which all your clients can already reach > over the network. > > Alternatively, you could abandon your Package resources in favor of > Execs of the form "yum localinstall -y <RPM package>". That gets you > out of creating either a repository or any custom facts, but it is > furthest from the Way, and the most disruptive to your current > manifests. > > > Good Luck, > > John-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7B76F9qD4fEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Mar-09 14:52 UTC
[Puppet Users] Re: Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
On Mar 8, 3:54 pm, Mike <mrwboil...@gmail.com> wrote:> Why does puppet return an error when a package is already installed?It doesn''t.> I use ensure => installed to make sure that a package is installed, and > then have a file that is dependent on that package. When the manifest is > applied and the package is already installed, it reports an error and then > doesn''t do anything with the file. Isn''t this a bug? The package type is > just supposed to ensure that the package is installed. If it sees that it > is already installed, that should be a good thing, not an error.Puppet checks whether the package is already installed before attempting to install it. If no change is needed then Puppet doesn''t do anything. Based on the other thread in which you are asking about this, I conclude that you are lying to Puppet about the name of the package. The RPM file you designate in your Package resource contains a package named differently than the package name you specified. It will work correctly if you give Puppet the correct package name, as Nan described. It''s much better, though, to set up a local yum repository to serve packages to your clients, even for only a handful of packages. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan White
2012-Mar-09 15:11 UTC
Re: [Puppet Users] Re: Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
What does the command: puppet resource package tell you about what packages are/are-not installed ? “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- jcbollinger <John.Bollinger@stJude.org> wrote:> > > On Mar 8, 3:54 pm, Mike <mrwboil...@gmail.com> wrote: > > Why does puppet return an error when a package is already installed? > > > It doesn''t. > > > > I use ensure => installed to make sure that a package is installed, and > > then have a file that is dependent on that package. When the manifest is > > applied and the package is already installed, it reports an error and then > > doesn''t do anything with the file. Isn''t this a bug? The package type is > > just supposed to ensure that the package is installed. If it sees that it > > is already installed, that should be a good thing, not an error. > > > Puppet checks whether the package is already installed before > attempting to install it. If no change is needed then Puppet doesn''t > do anything. > > Based on the other thread in which you are asking about this, I > conclude that you are lying to Puppet about the name of the package. > The RPM file you designate in your Package resource contains a package > named differently than the package name you specified. It will work > correctly if you give Puppet the correct package name, as Nan > described. > > It''s much better, though, to set up a local yum repository to serve > packages to your clients, even for only a handful of packages. > > > John > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeremy Baron
2012-Mar-09 18:45 UTC
Re: [Puppet Users] Re: Check package version in order to proceed with installation (err: Could not update: <package> is already installed)
On Fri, Mar 9, 2012 at 10:11, Dan White <ygor@comcast.net> wrote:> What does the command: > > puppet resource package > > tell you about what packages are/are-not installed ?See other thread. (was resolved) https://groups.google.com/d/topic/puppet-users/CE4iP7FtOiY/discussion -Jeremy -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.