ajcrowe / puppet-supervisord

Puppet Module to install and configure applications under supervisord
MIT License
37 stars 104 forks source link

Add class containment using the anchor pattern #24

Closed jbarbuto closed 10 years ago

jbarbuto commented 10 years ago

Without this, a wrapper class can't enforce ordering on the module.

http://puppetlabs.com/blog/class-containment-puppet

jbarbuto commented 10 years ago

You can duplicate with this test manifest

class foobarbaz {
  notify { 'foobarbaz': }
}

class bazbarfoo {
  notify { 'bazbarfoo': }
}

class wrapper {
  class { 'foobarbaz': } ->
  class { 'supervisord': } ->
  class { 'bazbarfoo': }
}

include wrapper

Without containment

Notice: /Stage[main]/Supervisord::Install/Package[supervisor]/ensure: created
...
Notice: /Stage[main]/Supervisord::Service/Service[supervisord]/ensure: ensure changed 'stopped' to 'running'
Notice: foobarbaz
Notice: /Stage[main]/Foobarbaz/Notify[foobarbaz]/message: defined 'message' as 'foobarbaz'
Notice: bazbarfoo
Notice: /Stage[main]/Bazbarfoo/Notify[bazbarfoo]/message: defined 'message' as 'bazbarfoo'

With containment

Notice: foobarbaz
Notice: /Stage[main]/Foobarbaz/Notify[foobarbaz]/message: defined 'message' as 'foobarbaz'
Notice: /Stage[main]/Supervisord::Install/Package[supervisor]/ensure: created
...
Notice: /Stage[main]/Supervisord::Service/Service[supervisord]/ensure: ensure changed 'stopped' to 'running'
Notice: bazbarfoo
Notice: /Stage[main]/Bazbarfoo/Notify[bazbarfoo]/message: defined 'message' as 'bazbarfoo'
ajcrowe commented 10 years ago

Thanks @jbarbuto really useful addition.