Hello everyone, I''m just getting to grips with Puppet so apologies if I''ve missed something. I''m wondering if there is a way to require that something isn''t the case. My current situation/example is that I''m trying to uninstall one package ("mysql") and install another one that conflicts with it ("MySQL-client-community") in one puppet run. I can do something like: package { [ "mysql" ] : ensure => absent, } package { [ "MySQL-client-community", ] : ensure => installed, } Which is fine, unless "MySQL-client-community" is scheduled to be installed before mysql is removed, in which case it errors and I''m left with a system with no mysql. Obviously, I can just run puppet again and it''ll be fine but I''d really like to do something like: package { [ "MySQL-client-community", ] : ensure => installed, require => ! Package[ "mysql" ] } with the ! negating the requirement. Is this possible or am I approaching this from the wrong angle and I should be doing something quite different? Thanks, Tim -- Tim Nicholas -- 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.
On May 17, 2010, at 9:35 PM, Tim Nicholas wrote:> I can do something like: > > package { [ "mysql" ] : ensure => absent, } > package { [ "MySQL-client-community", ] : ensure => installed, } > > Which is fine, unless "MySQL-client-community" is scheduled to be > installed before mysql is removed, in which case it errors and I''m > left with a system with no mysql. > > Obviously, I can just run puppet again and it''ll be fine but I''d > really like to do something like: > > package { [ "MySQL-client-community", ] : ensure => installed, > require => ! Package[ "mysql" ] } > > with the ! negating the requirement. > > Is this possible or am I approaching this from the wrong angle and I > should be doing something quite different?You''ve almost got it. I''ll work find if you remove the "!". That will require resource not the package itself and the resource says to remove the package. -- 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.
Hi Tim, What you want is this: package { "mysql": ensure => absent, before => Package["MySQL-client-community"]; } package { "MySQL-client-community": ensure => installed;} On Mon, May 17, 2010 at 9:35 PM, Tim Nicholas <tim@nicholas.net.nz> wrote:> Hello everyone, > > > I''m just getting to grips with Puppet so apologies if I''ve missed something. > > I''m wondering if there is a way to require that something isn''t the case. > > My current situation/example is that I''m trying to uninstall one > package ("mysql") and install another one that conflicts with it > ("MySQL-client-community") in one puppet run. > > I can do something like: > > package { [ "mysql" ] : ensure => absent, } > package { [ "MySQL-client-community", ] : ensure => installed, } > > Which is fine, unless "MySQL-client-community" is scheduled to be > installed before mysql is removed, in which case it errors and I''m > left with a system with no mysql. > > Obviously, I can just run puppet again and it''ll be fine but I''d > really like to do something like: > > package { [ "MySQL-client-community", ] : ensure => installed, > require => ! Package[ "mysql" ] } > > with the ! negating the requirement. > > Is this possible or am I approaching this from the wrong angle and I > should be doing something quite different? > > > Thanks, > Tim > > -- > Tim Nicholas > > -- > 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.
package { "MySQL-client-community" : ensure => installed, require => Package[ "mysql" ] } will just work, as you are requiring the the mysql package is already absent before you install the other package. Ohad On Tue, May 18, 2010 at 12:35 PM, Tim Nicholas <tim@nicholas.net.nz> wrote:> Hello everyone, > > > I''m just getting to grips with Puppet so apologies if I''ve missed > something. > > I''m wondering if there is a way to require that something isn''t the case. > > My current situation/example is that I''m trying to uninstall one > package ("mysql") and install another one that conflicts with it > ("MySQL-client-community") in one puppet run. > > I can do something like: > > package { [ "mysql" ] : ensure => absent, } > package { [ "MySQL-client-community", ] : ensure => installed, } > > Which is fine, unless "MySQL-client-community" is scheduled to be > installed before mysql is removed, in which case it errors and I''m > left with a system with no mysql. > > Obviously, I can just run puppet again and it''ll be fine but I''d > really like to do something like: > > package { [ "MySQL-client-community", ] : ensure => installed, > require => ! Package[ "mysql" ] } > > with the ! negating the requirement. > > Is this possible or am I approaching this from the wrong angle and I > should be doing something quite different? > > > Thanks, > Tim > > -- > Tim Nicholas > > -- > 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<puppet-users%2Bunsubscribe@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.
Ah. Thanks everyone. I new I''d misunderstood something. On 18 May 2010 16:49, Ohad Levy <ohadlevy@gmail.com> wrote:> package { "MySQL-client-community" : ensure => installed, require => > Package[ "mysql" ] } > > will just work, as you are requiring the the mysql package is already absent > before you install the other package. > > Ohad > > > On Tue, May 18, 2010 at 12:35 PM, Tim Nicholas <tim@nicholas.net.nz> wrote: >> >> Hello everyone, >> >> >> I''m just getting to grips with Puppet so apologies if I''ve missed >> something. >> >> I''m wondering if there is a way to require that something isn''t the case. >> >> My current situation/example is that I''m trying to uninstall one >> package ("mysql") and install another one that conflicts with it >> ("MySQL-client-community") in one puppet run. >> >> I can do something like: >> >> package { [ "mysql" ] : ensure => absent, } >> package { [ "MySQL-client-community", ] : ensure => installed, } >> >> Which is fine, unless "MySQL-client-community" is scheduled to be >> installed before mysql is removed, in which case it errors and I''m >> left with a system with no mysql. >> >> Obviously, I can just run puppet again and it''ll be fine but I''d >> really like to do something like: >> >> package { [ "MySQL-client-community", ] : ensure => installed, >> require => ! Package[ "mysql" ] } >> >> with the ! negating the requirement. >> >> Is this possible or am I approaching this from the wrong angle and I >> should be doing something quite different? >> >> >> Thanks, >> Tim >> >> -- >> Tim Nicholas >> >> -- >> 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. >-- Tim Nicholas Cell/SMS: +64 21 337 204 -- 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.