> However, I also tried this (I posted this before in this thread abut
> can't see that anymore):
> 
> package {
>         'httpd': notify => Exec[ 'remove-httpd' ];
>     }
> 
> exec { 'remove-httpd':
>         command     => '/usr/bin/yum remove -y httpd',
>         refreshonly => true,
>     }
> 
> but doesn't work either. What am I doing anything wrong here? Cheers!!

Hi,

this is a very bad idea and abuse of notify.

The above tells puppet "whenever you change the httpd package (install
it, remove it, update it) do that exec afterwards".

But the package has no ensure, so puppet will never try anything with
the package. Even if you set "ensure => absent" (which didn't work for
you), the notify wouldn't fire either, because puppet wasn't able to
perform the requested action in the first place. Depending resources
(and notify implies a dependency) are skipped after such errors.

You do not want to manage a package using both a native type and an
exec. That's bound to blow up into your face. In fact, try to *not ever*
call out to your package manager in an exec.

As an aside, notify => exec is almost always inferior to a good "exec {
onlyif => ... }" rule.
If you make a booboo in your exec, you may later have a hard time
generating a new notify. Conditions in "onlyif" and "unless" are a lot
more reliable.
Here, you should have used an onlyif involving "rpm -q". But don't do
that ;-)

Regards,
Felix

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

Reply via email to