On Fri, May 13, 2011 at 3:59 AM, 孫 顥 <xsunsm...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.