孫 �
2011-May-13 08:59 UTC
[Puppet Users] how to rescue a dependency failure and try another one?
I am very new to puppet. exec {"apt-update": } exec {"install-local": } service { "apache2": require => Exec["apt-update"] } when apt repository has network errors, I wanna puppet do "install-local" instead, and make service apache2 run as normal, how can i do that? Thank you in advance. -- ---- 孫より -- 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.
Nan Liu
2011-May-13 23:54 UTC
Re: [Puppet Users] how to rescue a dependency failure and try another one?
On Fri, May 13, 2011 at 3:59 AM, 孫 顥 <xsunsmile@gmail.com> wrote:> > I am very new to puppet. > exec {"apt-update": } > exec {"install-local": } > service { "apache2": > require => Exec["apt-update"] > } > when apt repository has network errors, I wanna puppet do "install-local" > instead, > and make service apache2 run as normal, how can i do that?Puppet can''t conditionally execute commands, but you can abuse ||: exec { "apt_or_install" command => "apt-update || install-local", } service { "apache2": require => Exec["apt_or_install"], } Thanks, Nan -- 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.
孫 �
2011-May-14 00:24 UTC
Re: [Puppet Users] how to rescue a dependency failure and try another one?
Hi, I love this idea. Thank you. 2011/5/14 Nan Liu <nan@puppetlabs.com>> On Fri, May 13, 2011 at 3:59 AM, 孫 顥 <xsunsmile@gmail.com> wrote: > > > > I am very new to puppet. > > exec {"apt-update": } > > exec {"install-local": } > > service { "apache2": > > require => Exec["apt-update"] > > } > > when apt repository has network errors, I wanna puppet do "install-local" > > instead, > > and make service apache2 run as normal, how can i do that? > > Puppet can''t conditionally execute commands, but you can abuse ||: > > exec { "apt_or_install" > command => "apt-update || install-local", > } > service { "apache2": > require => Exec["apt_or_install"], > } > > Thanks, > > Nan > > -- > 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.