Hi, I am trying to combine some rules from http://docs.puppetlabs.com/learning/variables.html: 1. Top scope variables are the same, but their scope is nameless. (For example: $::top_scope_variable.) 2. To distinguish a ${variable} from the surrounding text, you should wrap its name in curly braces. So, to get a fact, I was writing: ${::operatingsystem} To get a global var from site.pp, I was writing: ${::firewall_etc} These give me errors like: Could not parse for environment production: Could not match ${::operatingsystem} at... Isn''t that supposed to work? Best regards, Martijn Grendelman -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, 17 Oct 2011 17:53:39 +0200 Martijn Grendelman wrote:> Hi,Hi, [...]> These give me errors like: > > Could not parse for environment production: Could not match > ${::operatingsystem} at...Where are you setting those vars? I''ve seen that, on 2.6, setting those vars in selectors does not work. source => $operatingsystem ? {> Isn''t that supposed to work? > > Best regards, > Martijn GrendelmanHTH, Arnau -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sent to early :-) source => $::operatingsystem ? { *without quotes.> Isn''t that supposed to work? > > Best regards, > Martijn GrendelmanHTH, Arnau -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
$operatingsystem "$operatingsystem" "${operatingsystem}" ${operatingsystem} Produce exactly the same thing. One would assume that the short forms for expression interpolation i.e.: ${operatingsystem} "$operatingsystem" would recognize an initial empty namespace (i.e. "::operatingsystem"). If not, I think it is a bug. After all: ${somescope::somevar} works afaict. In case you just want the variable value, there is no need to interpolate it in a double quoted string, or with the ${} around it (as that is also a string interpolation in short form for "${}"). If you really need to interpolate - did you try: "blah blah ${$::operatingsystem} and blah" ? Regards - henrik On 10/17/11 5:53 PM, Martijn Grendelman wrote:> Hi, > > I am trying to combine some rules from > http://docs.puppetlabs.com/learning/variables.html: > > 1. Top scope variables are the same, but their scope is nameless. (For > example: $::top_scope_variable.) > 2. To distinguish a ${variable} from the surrounding text, you should wrap > its name in curly braces. > > So, to get a fact, I was writing: > > ${::operatingsystem} > > To get a global var from site.pp, I was writing: > > ${::firewall_etc} > > These give me errors like: > > Could not parse for environment production: Could not match > ${::operatingsystem} at... > > > Isn''t that supposed to work? > > Best regards, > Martijn Grendelman >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.