It would be great if I was able to refer to a variable in a class namespace
using only it's string value.

I guess this is a kind of eval-esque construct for those familiar with Perl
and Python.

Example source :-

^^^^^^^^^^^^^^^^^^^^^^^^^^^

$classname = 'foo'

class foo {
    $bar = "baz"
    notice("I am class $classname with a variable \$bar=$bar")
}

include $classname    #   Awesome - I can use a string value for class
includes!
notice("$foo::bar")    #    I can reference a value using its *actual* name
...

#   But this doesn't work ...

$value = inline_template("$<%= classname %>::bar")

notice("I'd really like 'baz' below but I only get \$foo::bar")
notice("$value")

^^^^^^^^^^^^^^^^^^^^^^^^^^^

output :-

notice: Scope(Class[foo]): I am class foo with a variable $bar=baz
notice: Scope(Class[main]): baz
notice: Scope(Class[main]): I'd really like 'baz' below but I only get
$foo::bar
notice: Scope(Class[main]): $foo::bar

So near and yet so far :-(

Is there a way to do this using some special syntax, a function call or a
possible plugin perhaps?

Dave M.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to