-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nick,

Here's what I used to try it:

#class foo {
#  notify { "blah": }
#}

#if defined( Class["foo"] ) {
#  notify { "found_foo": }
#}

#$foo = "blah2"

if defined( "foo" ) {
  notify { "found_foo2": }
}

$bar = "blah"

if defined( "bar" ) {
  notify { "found_bar": }
}

At this state, you should get 'found_bar' and that's it.

If you uncomment either the class or the 'foo' variable, you should get
'found_foo2'.

If you uncomment both the class *and* the 'foo' variable, you should get
'found_foo2'.

Trevor

On 01/26/2011 02:19 PM, Nick Fagerlund wrote:
> Hi, Trevor!
> 
> On Jan 26, 7:32 am, Trevor Vaughan <[email protected]> wrote:
>> Maybe I'm missing something here.
>>
>> class foo { ... }
>>
>> and
>>
>> $foo
>>
>> Both trigger: defined('foo')
> 
> I cannot for the life of me get this to work on either 2.6.4 or
> 0.25.5. This code:
> 
> $somevar = "var."
> 
> notice('$somevar defined?')
> notice(defined($somevar))
> notice('')
> 
> notice('somevar defined?')
> notice(defined(somevar))
> notice('')
> 
> notice('"$somevar" defined?')
> notice(defined("$somevar"))
> notice('')
> 
> notice('\'$somevar\' defined?')
> notice(defined('$somevar'))
> notice('')
> 
> notice('"somevar" defined?')
> notice(defined("somevar"))
> notice('')
> 
> notice('\'somevar\' defined?')
> notice(defined('somevar'))
> 
> 
> ... gives me a whole pile of "false;" as far as I could determine,
> defined() ignores variables. Could you get me some more info on how
> you got that to happen?
> 
> Thanks,
> N
> 

- -- 
Trevor Vaughan
 Vice President, Onyx Point, Inc.
 email: [email protected]
 phone: 410-541-ONYX (6699)
 pgp: 0x6C701E94

- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJNQHSoAAoJECNCGV1OLcyp/KkH/igdzyv3Y1zRXz5KAB32O8sV
VIDgaR9pRGB16XLeCHS03flxB/6sE3KwX7q3QtKn0NEdImfzAQuy/9b+XYIOThbF
FFo4AV63NYvGazpshRwlG3zmvN7FQIlW35sKKZOlqknwqm8kr+HKibMjcrD9CZU0
Hk6wZwFPcx2cXFYBzl1O/l8DY+lRDn97947LigvL7Y4v/lXfSNC98h3/21c5KZ7O
LAYnr3a6zKxoPyLBI3gR4Xsfefe777dERofaaIubSFUHgQbBueasiY+z8CO35Z3U
gbX40CwB+xI5mZQB76nWedEuVLFCy6ftU9R4P6iTukO6laRVJae61HMXB+9ZyHk=
=jc5M
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

<<attachment: tvaughan.vcf>>

Reply via email to