Since in this case, it's checking that supervisor::service exists so it can 
declare one, I'd say checking for just 'supervisor::service' would be fine. 
You may want to stay around and see what other people think though, as I 
could be missing something.

Looking at it again, the check to see if a class has been declared seems 
really odd... and testing it now that I have a second, it doesn't actually 
seem to work at all. I'm not sure how idiomatic that is, or was, but maybe 
someone else can shed some light on it.

On Monday, August 19, 2013 8:32:39 PM UTC-7, Florian Gray Jones wrote:
>
> ok, that's great. Thanks for the help.
>
> The puppet-docs it says: "*Modules are how Puppet finds the classes and 
> types it can use* — it automatically loads any 
> class<http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html>
>  or defined 
> type<http://docs.puppetlabs.com/puppet/2.7/reference/lang_defined_types.html> 
> stored 
> in its modules."
>
> With this in mind, if "*if *defined(Class[ ])" checks for classes.. and 
> in my case 'supervisor::service' is as you mentioned not a class but a 
> define. Is there an equivalent like "if defined(Define[ ])" or is best 
> practice to continue using "if defined('supervisor::service')" to just 
> check for anything of that name.
>
> Thanks again
> fLo
>
>
>
> On Monday, 19 August 2013 23:33:09 UTC+8, Florian Gray Jones wrote:
>>
>> Hi,
>>
>> I am learning puppet using version 2.7.18 on a fresh ubuntu install.
>>
>> I am trying to test this module 
>> https://github.com/liamjbennett/puppet-sabnzbd/blob/master/manifests/init.ppbut
>>  I'm having trouble with the 
>> if defined(Class['supervisor::service']) section in that it doesn't get 
>> run even though the supervisor module is installed.
>>
>> If i put "else{ notice("supervisor not defined?") }" on the end then I 
>> see that notice msg in the 'puppet apply --debug' output.
>>
>> This supervisor module is downloaded/installed OK from Puppet Forge and 
>> if I either 
>>
>> a) comment out the 'if defined' then it works as expected 
>> b) *change the if *defined(Class['supervisor::service']) to read if 
>> defined('supervisor::service') then it also works as expected.
>>
>> As you can see there is an "include supervisor" at top of the class which 
>> I'm guessing isn't being called in the 
>> order needed for the 'if defined' to work and the one without the Class[] 
>> must work because puppet auto loads the modules from the modulepath
>> and checks if that namespace and module exist?
>>
>> This is all new to me so i could be very wrong but can anyone explain 
>> given that init.pp why the 'if defined' isn't working and what is the best
>> way to achieve what the 'if defined' is there for and that's to see if 
>> the supervisor module is installed/loaded before entering the if statement 
>> and using the module?
>>
>> Many thanks for reading
>> fLo
>>
>>
>>
>>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to