I'm testing a 'cleanup' stage which runs after Stage[main] and removes a bunch 
of package resources.

To do this, I tried a simple check of defined(Package[<foo>]) combined with a 
custom facter fact (called 'app_packages'):

> class app::package::cleaner {
> 
>   define check_and_remove {
>     if !defined(Package[$title]) {
>       package { $title:
>         ensure => absent
>       }
>     }
>   }
> 
>   $apps = split($::app_packages, ',')
>   check_and_remove { $apps: }
> 
> }
> 
> node 'foo' {
>   class { 'app::package::cleaner': stage => 'cleanup' }

> }

Unfortunately, this results in a dependency cycle.  It appears that putting the 
Package[$title] resource reference in defined() actually invokes an implicit 
dependency between my cleanup helper resource in the cleanup stage and the 
original Package resource in the main stage.

> Augeas[redacted] => Service[iptables] => Class[Iptables] => Stage[main] => 
> Stage[cleanup] => Class[App::Package::Cleaner] => 
> App::Package::Cleaner::Check_and_remove[package-434] => Package[package-434] 
> => Exec[app-graceful-restart] => Class[App] => Stage[main]

Is this implicit dependency expected behaviour or am I doing something Bad(tm)?

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to