There is something basically wrong with this, IMHO

If you need to do this, it means that there could be more than one place to 
instantiate the class, and we all know the problems caused by doing it more 
than once.

You may want to consider refactoring to separate the class instantiation from the 
multiple locations.“Sometimes I think the surest sign that intelligent life exists 
elsewhere in the universe is that none of it has tried to contact us.” (Bill 
Waterson: Calvin & Hobbes)

On Apr 02, 2015, at 07:52 AM, "paul.gomersbach" <p.gomersb...@gmail.com> wrote:

This is working for me:

  if ! defined(Class['ops_logging']) {
    class { 'ops_logging':
      collectives   => $collectives,
      middleware    => $rabbithost,
      metrics       => $metrics,
      configuration => $configuration,
      monitor       => $monitor,
    }
  }


Op woensdag 1 april 2015 20:35:06 UTC+2 schreef guymatz:

    I've seen some folks say this should work:

    if defined(::class::subclass)

    but it doesn't seem to work for me.  Again, any thoughts would be greatly 
appreciated!

    Regards,
    Guy

    On Wed, Apr 1, 2015 at 11:26 AM, Guy Matz <guy...@gmail.com> wrote:

Hi! I have a process that is controlled by daemontools on some servers, and by init on other (i know, i know) and I need a way to have a Service definition when daemontools is not in the run.
        I've tried this:
          unless defined(Class['daemontools']) {
            notify { 'I Do not see daemontools': }
            service { $dw_service:
              ensure    => 'running'
            }
          }

        but that didn't work.  I've also tried Class['Daemontools'].

Daemontools is the module being used, but it's a actually a subclass, daemontools::service, that's being called . . . So I've also tried Class['daemontools::service'] as well as Class['Daemontools::Service']. I've tried Class['::Daemontools::Service'], which didn't work either.

        I added a notify in daemontools::service which gave me this:
        Notice: 
/Stage[main]/Profiles::Dropwizard::Booker-integration/Daemontools::Service[booker-integration]/Notify[Here
 I am!!]/message: defined 'message' as 'Here I am!!'

        So I also tried "unless 
defined(Class['Daemontools::Service[booker-integration]']), which, of course, did 
not work.

        Anyone know what I need to get the "unless" to catch whether I am using 
daemontools::service?  And even better, doers anyone know how I could have debugged this 
to find this out for myself?

        Thanks so much!
        Guy



--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/99788530-31bd-455f-b2e4-8801982cd09b%40googlegroups.com.
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bd9d68bd-8ca1-43ef-bae2-818eb334d69e%40me.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to