Hm, ok.
But when I use 'subscribe' instead of 'notify' 

class testmod {
   package { 'nginx': ensure  => installed }
   service { 'nginx':
    ensure    => running,
    enable    => true,
    require   => Package['nginx'],
    subscribe => File['/tmp/nginx.test']
   }
}
class testmod::nginxtest {
  file { '/tmp/nginx.test':
    ensure => present
  }
}

I get

==> test-node: Error: Could not apply complete catalog: Found 1 dependency 
cycle:
==> test-node: (File[/tmp/nginx.test] => Service[nginx] => Class[Testmod] => 
Class[Testmod::Nginxtest] => File[/tmp/nginx.test])
==> test-node: Try the '--graph' option and opening the resulting '.dot' file 
in OmniGraffle or GraphViz

I do need to have 2 separate modules. I need the class 'testmode' to run before 
class 'test mod::nginxtest'. And I need to restart service 'nginx' when I 
change '/tmp/nginx.test'.

So then the question is - how to do this properly? Do I need to create 
something like exec { 'nginx restart': ... } ? 


On Jun 18, 2014, at 5:55 PM, Felix Frank <[email protected]> 
wrote:

> Hi,
> 
> On 06/18/2014 03:51 PM, Sergey Arlashin wrote:
>> Could you please help me figure out why this is happening ? It seems there 
>> is nothing in test mod whih requires testmod::nginxtest .
> 
> actually yes, there is.
> 
>  file { '/tmp/nginx.test':
>    ensure => present,
>    notify => Service['nginx'];
>  }
> 
> The 'notify' implicitly puts File['/tmp/nginx.test'] *before*
> Service['nginx'].
> 
> The
> 
>  class { 'testmod::nginxtest':
>    require => Class['testmod']
>  }
> 
> ends up doing the opposite - wanting the Service['nginx'] before
> File['/tmp/nginx.test'].
> 
> HTH,
> Felix
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/53A19A45.30903%40alumni.tu-berlin.de.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9548D943-73FE-41B1-984C-1EDC8FAD40D3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to