Re: [Puppet Users] how to rescue a dependency failure and try another one?

2011-05-13 Thread 孫 邕
Hi, I love this idea.
Thank you.

2011/5/14 Nan Liu 

> On Fri, May 13, 2011 at 3:59 AM, 孫 顥  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.
>
>


-- 

孫より

-- 
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.



Re: [Puppet Users] how to rescue a dependency failure and try another one?

2011-05-13 Thread Nan Liu
On Fri, May 13, 2011 at 3:59 AM, 孫 顥  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.