Am Dienstag, dem 29.07.2025 um 20:56 -0500 schrieb 'Tim Mooney' via
Puppet Users:

> I've found recommendations suggesting each of these:
> 
>         <%= $facts['os']['release']['major'] %>
>         <%= @facts['os']['release']['major'] %>
>         <%= $facts.dig("os","release","major") %>
>         <%= @facts.dig("os","release","major") %>

The "$" variants are non-sense. Use "@" to access variables defined
OUTSIDE the template (@somevar or @facts[]) and omit it from variables
defined INSIDE the template.

> as well as suggestions to use scope[] or scope.lookupvar() or use

"scope[]" MUST be used to access variables defined in a different
class, for example if a template is used in a sub-class, but the
variables it uses are defined in the main class. The classical example
for this is the separation of "myclass" into "init.pp" (which defines
the parameters), "install.pp", "config.pp" (where a config file is
generated from a template) and "service.pp".

The notation in this case is

   <%= scope['myclass::param'] =>
   
or, if the parameter or variable is an array or hash map

   <%= scope['myclass::param'][<index or key>] =>

HTH...

 Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Email: dhein...@opentext.com
Website: www.recommind.de
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Christian Waida, Registergericht
Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-
Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/puppet-users/0c989787e93bde86899e328f3044b457c3f22689.camel%40opentext.com.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to