Re: [Puppet Users] Downgrade package via yum

2009-12-22 Thread Matthew Hyclak
On Tue, Dec 22, 2009 at 1:36 AM, Tony G. tony...@gmail.com wrote:
 Thanks for the comments Silviu, here what I found:

 I ran:
 /usr/sbin/puppetd -vdt --fqdn `hostname` --environment=development --test

 This is the excerpt of the output:
 debug:
 //Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]:
 Changing ensure
 debug:
 //Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]:
 1 change(s)
 debug: Package[nrpe_custom](provider=yum): Ensuring = 01.1-10
 debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0
 -y install nrpe_custom-01.1-10'
 debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q
 nrpe_custom --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}|
 %{VERSION} %{RELEASE} %{ARCH}'

 err:
 //Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]/ensure:
 change from 01.2-20 to 01.1-10 failed: Could not update: Failed to update to
 version 01.1-10, got version 01.2-20 instead at
 /opt/puppet/development/classes/common.pp:61

 Running it manually I got:

 1. /usr/bin/yum -d 0 -e 0 -y install nrpe_custom-01.1-10
 Package matching nrpe_custom-01.1-10.x86_64 already installed. Checking for
 update.

 Which is not true, but for some reason yum believes it is already
 installed

 2. /bin/rpm -q nrpe_custom --nosignature --nodigest --qf %{NAME}
 %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
 nrpe_custom 0 01.2 20 x86_64

 Then Puppet after matching the versions complains with the Error saying the
 update didn't happen.

 From my point of view this is an issue with yum that is not installing the
 version defined in puppet.

 As I previously said, if I do a /usr/bin/yum -d 0 -e 0 -y downgrade
 nrpe_custom-01.1-10 it successfully installs the defined version.

 My concern is that Puppet states that the handling of packages via yum is
 versionable(The provider is capable of interrogating the package database
 for installed version(s), and can select which out of a set of available
 versions of a package to install if asked), which I assumed puppet will find
 the way to exec yum to update *or downgrade* as in this case, but I guess I
 took that too literal, and perhaps that is the definition of what a
 versionable package handler as YUM does, but not exactly with Puppet.

 Wish I'll be wrong, but seems like I won't be able to downgrade packages via
 yum.

 Comments?


Downgrade via yum is done by a plugin that comes with some caveats
(like how do you downgrade a post script that creates a user in
version 2, but not in version 1). This plugin is also not supported on
some earlier versions of yum.

It might be possible to modify the yum provider in puppet to check for
the existence of the plugin, and if the requested version is less than
the installed version, call yum with the downgrade option. My
recommendation would be to open a feature request in the bug tracker
and let someone more versed in ruby and the provider than I am
comment.

Matt

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.




Re: [Puppet Users] Downgrade package via yum

2009-12-22 Thread R.I.Pienaar
hello,

- Matthew Hyclak hyc...@gmail.com wrote:

  Wish I'll be wrong, but seems like I won't be able to downgrade
 packages via yum.
 
 Downgrade via yum is done by a plugin that comes with some caveats
 (like how do you downgrade a post script that creates a user in
 version 2, but not in version 1). This plugin is also not supported
 on some earlier versions of yum.
 
 It might be possible to modify the yum provider in puppet to check
 for the existence of the plugin, and if the requested version is less
 than the installed version, call yum with the downgrade option. My
 recommendation would be to open a feature request in the bug tracker
 and let someone more versed in ruby and the provider than I am
 comment.


automated, unattended and untested downgrading of packages is a recipe for 
disaster, I think puppet is right in by default not doing downgrades since 
while it might work for your package in this case, it certainly wont work for 
many, I've seen downgrades leaving machines very broken indeed due to post 
scripts not being written to support it as Matthew correctly points out.

If we are to add support for downgrades I'd say it should come with an 
additional force = true style property on the package resource as it really is 
very dangerous.

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.




Re: [Puppet Users] Downgrade package via yum

2009-12-21 Thread Tony G.
Thanks for the comments Silviu, here what I found:

I ran:
/usr/sbin/puppetd -vdt --fqdn `hostname` --environment=development --test

This is the excerpt of the output:
debug: 
//Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]:
Changing ensure
debug: 
//Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]:
1 change(s)
debug: Package[nrpe_custom](*provider=yum*): Ensuring = *01.1-10*
debug: Puppet::Type::Package::ProviderYum: Executing '*/usr/bin/yum -d 0 -e
0 -y install nrpe_custom-01.1-10*'
debug: Puppet::Type::Package::ProviderYum: Executing *'/bin/rpm -q
nrpe_custom --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}|
%{VERSION} %{RELEASE} %{ARCH}*'

err: 
//Node[puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]/ensure:
change from 01.2-20 to 01.1-10 failed: Could not update: Failed to update to
version 01.1-10, got version 01.2-20 instead at
/opt/puppet/development/classes/common.pp:61

Running it manually I got:

1. /usr/bin/yum -d 0 -e 0 -y install nrpe_custom-01.1-10
Package matching nrpe_custom-01.1-10.x86_64 already installed. Checking for
update.

Which is not true, but for some reason yum believes it is already
installed

2. /bin/rpm -q nrpe_custom --nosignature --nodigest --qf %{NAME}
%|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
nrpe_custom 0 01.2 20 x86_64

Then Puppet after matching the versions complains with the Error saying the
update didn't happen.

From my point of view this is an issue with yum that is not installing the
version defined in puppet.

As I previously said, if I do a */usr/bin/yum -d 0 -e 0 -y
downgradenrpe_custom-01.1-10
*it successfully installs the defined version.

My concern is that Puppet states that the handling of packages via yum is
versionable http://reductivelabs.com/trac/puppet/wiki/TypeReference#id70(*The
provider is capable of interrogating the package database for installed
version(s), and can select which out of a set of available versions of a
package to install if asked*), which I assumed puppet will find the way to
exec yum to update *or downgrade* as in this case, but I guess I took that
too literal, and perhaps that is the definition of what a versionable
package handler as YUM does, but not exactly with Puppet.

Wish I'll be wrong, but seems like I won't be able to downgrade packages via
yum.

Comments?

Thanks!

On Fri, Dec 18, 2009 at 7:39 PM, Silviu Paragina sil...@paragina.ro wrote:

 You may try to use the debug method I described here

 http://groups.google.com/group/puppet-users/browse_thread/thread/40a0cbdc8ade0d71/099af2828b89871e?lnk=gstq=yum#099af2828b89871e


 Silviu

 Tony G. wrote:
  Hi,
 
  On our organization we have custom npre packages distributed via yum,
  few days ago a new test package was updated in the repository and new
  nodes installed this version, the code looked like this:
 
  class common::nagios {
package { nrpe_custom: ensure = installed }
  }
 
  To attempt to fix it I wanted to take control of which version we are
  deploying by doing:
  class common::nagios {
$nrpe_version = 01.1-10
package { nrpe_custom: ensure = $nrpe_version }
  }
 
  The logs show that there was a problem updating(actually downgrading)
  but does not give me a clue of what might be going wrong:
  Dec 19 00:38:25 puppetclient puppetd[3759]:
  (//Node[puppetclient.example.com
  http://puppetclient.example.com
 ]/common/common::nagios/Package[nrpe_custom]/ensure)
  change from 01.2-20 to 01.1-10 failed: Could not update: Failed to
  update to version 01.1-10, got version 01.2-20 instead at
  /opt/puppet/test/classes/common.pp:61
 
  If on the client machine I attempt to downgrade via yum downgrade
  nrpe_custom-01.1, the package get's downgraded correctly. I had the
  understanding that package yum is versionable and I should be able to
  do this kind of changes.
 
  Any suggestion that could help to solve this.
 
  Thanks
  --
  Tony
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Puppet Users group.
  To post to this group, send email to puppet-us...@googlegroups.com.
  To unsubscribe from this group, send email to
  puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.





-- 
Tony

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 

Re: [Puppet Users] Downgrade package via yum

2009-12-18 Thread Silviu Paragina
You may try to use the debug method I described here 
http://groups.google.com/group/puppet-users/browse_thread/thread/40a0cbdc8ade0d71/099af2828b89871e?lnk=gstq=yum#099af2828b89871e


Silviu

Tony G. wrote:
 Hi,

 On our organization we have custom npre packages distributed via yum, 
 few days ago a new test package was updated in the repository and new 
 nodes installed this version, the code looked like this:

 class common::nagios {
   package { nrpe_custom: ensure = installed }
 }

 To attempt to fix it I wanted to take control of which version we are 
 deploying by doing:
 class common::nagios {
   $nrpe_version = 01.1-10
   package { nrpe_custom: ensure = $nrpe_version }
 }

 The logs show that there was a problem updating(actually downgrading) 
 but does not give me a clue of what might be going wrong:
 Dec 19 00:38:25 puppetclient puppetd[3759]: 
 (//Node[puppetclient.example.com 
 http://puppetclient.example.com]/common/common::nagios/Package[nrpe_custom]/ensure)
  
 change from 01.2-20 to 01.1-10 failed: Could not update: Failed to 
 update to version 01.1-10, got version 01.2-20 instead at 
 /opt/puppet/test/classes/common.pp:61

 If on the client machine I attempt to downgrade via yum downgrade 
 nrpe_custom-01.1, the package get's downgraded correctly. I had the 
 understanding that package yum is versionable and I should be able to 
 do this kind of changes.

 Any suggestion that could help to solve this.

 Thanks
 -- 
 Tony

 --

 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to 
 puppet-users+unsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.