-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I try to cleanup my config due to some deprecation warnings but with
"inline_template" i run into some trouble.

This is my class:
> 1 class test { 2  $var1 = 'foo' 3  $var2 = 'bar' 4  $vars = 
> ["var1","var2"] 5  notice($var1) 6  notice($var2) 7  notice($vars)
>  8  each($vars) |$var| { 9    $vardata = inline_template("<%= 
> scope.lookupvar(var) %>") 10    notice("$var: $vardata") 11  } 11 
> }

If I run this like this
puppet apply --parser future --modulepath=/root/puppet/modules
- --environment=production --loadclasses --noop --verbose puppet/site.pp

I get the following outpu with deprecation warning:
> Notice: Scope(Class[Test]): foo Notice: Scope(Class[Test]): bar 
> Notice: Scope(Class[Test]): var1 var2 Warning: Variable access via 
> 'var' is deprecated. Use '@var' instead. template[inline]:1 (at 
> (erb):1:in `result') Notice: Scope(Class[Test]): var1: foo Notice: 
> Scope(Class[Test]): var2: bar

Ok, if I change line 9 to
> 9    $vardata = inline_template("<%= scope.lookupvar(@var) %>")

I get this Error:
> Notice: Scope(Class[Test]): foo Notice: Scope(Class[Test]): bar 
> Notice: Scope(Class[Test]): var1 var2 Error: Failed to parse
> inline template: Scope variable name is a NilClass, not a string
> at /root/test.pp:14 on node hackweek.office.b1-systems.de Error: 
> Failed to parse inline template: Scope variable name is a
> NilClass, not a string at /root/test.pp:14 on node 
> hackweek.office.b1-systems.de

Can anyone tell me what I'm doing wrong here?


Regards
Mario van der Linde

- -- 
Mario van der Linde
Linux Consultant & Trainer
Tel.: +49-151-16879485
Mail: [email protected]

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHNtPMACgkQ0xt2iESAuwQ7hQCfSgee4Qy+bJ+94ZH4baSuoXcm
9W0An1GcopqgWRk6RvugZIiN6xyN7POy
=VE8g
-----END PGP SIGNATURE-----

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to