Ask Your Question
0

Variable is undefined but interpolates to a value

asked 2015-04-22 21:41:14 -0500

Supermathie gravatar image

Whlie tracing a problem ( http://pastie.org/10108429 ) I observed the following root cause:

notice("$::lsbdistid")
notice(defined('$::lsbdistid'))

on the master produces the output:

Apr 23 01:15:32 puppetmaster puppet-master[10104]: (Scope(Class[main])) Ubuntu
Apr 23 01:15:32 puppetmaster puppet-master[10104]: (Scope(Class[main])) false

How is that even possible? What could be going on here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-04-23 00:04:18 -0500

GregLarkin gravatar image

There is a bug in the defined function that prevents it from handling top-scope variables correctly. You can either omit the "::" operator, assuming there is no local-scope variable with the same name already, or you can assign the top-scope variable to a local-scope variable and pass it to the defined() function instead.

Also see https://tickets.puppetlabs.com/browse/PUP-3718, and it appears this will be fixed (or has been by now, since it was just released) in Puppet 4.0.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-22 21:41:14 -0500

Seen: 177 times

Last updated: Apr 23 '15