I think that you are having a problem here because $java is not
expanded/interpolated as a variable and the template solves it. You can
safely use the fully qualified name and this should work:
$java_home = ${java::jdk_1_7_u10::home}
Of course if you want to use $java as a variable you will have to use a
templates. If you tell us more about your usecase and setup - there are
often better ways to do what you want - hiera comes mind first; also
java::params class comes second with the home set as parameter for
different setups
--
Nikola
On Tue, Jul 02, 2013 at 05:53:24PM -0700, Schofield
wrote:> Given
>
> class java::jdk_1_7_u10{
> home=/usr/java/jdk-1.7.0-10
> }
>
> $java = jdk_1_7_u10
> $java_home = ${java::$java::home}
>
> I would like $java_home to be equal to /usr/java/jdk-1.7.0-10. Is there an
> elegant way to make this work? We currently use an inline template to make
> it work.
>
> java_home =>
inline_template("<%=scope.lookupvar(''java::${java}::home'')%>"),
>
> But this has always felt like a hack to me so I am curious to know if there
> is a better way? Currently running puppet 3.0.0.
>
> --
> 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 puppet-users+unsubscribe@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.