No, if you remove the defined() call and just include it will fail to find
the class. Defined() is there simply to ensure that we can do the include.
For a bit more context I've written an abstraction layer that assigns
apps/roles to nodes and will pull in profiles if they exist, that is where
this snipit is from.
So changing this to:
if ($profile == 'existantclass') {
include "profile::${separator}::${profile}"
}
results in Error 400 on SERVER: Could not find class
profile::app::existantclass for node1.vnet on node node1.vnet.
Me and defined() have had a rocky but ultimately agreeable relationship.
On Tuesday, January 6, 2015 4:49:04 PM UTC-7, Felix.Frank wrote:
>
> On 12/30/2014 09:05 PM, Matthew Kennedy wrote:
>
>
> if (defined("profile::${separator}::${profile}")) {
> include "profile::${separator}::${profile}"
> }
>
>
> Hi,
>
> Is the if defined() construct significant? Can you only reproduce when it
> is in place? Why is it there and what does it do?
>
> Note that, regardless of this issue, using this function can be hazardous.
>
> Thanks,
> 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/efefacf2-5313-4020-bbe7-f91fc86ee694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.