Mario van der Linde
2013-Jun-28 16:08 UTC
[Puppet Users] Scope variable name is a NilClass
-----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: barOk, 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.deCan 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: linde@b1-systems.de 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 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.
Mario van der Linde
2013-Jul-01 07:07 UTC
Re: [Puppet Users] Scope variable name is a NilClass
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I''ve just seen that the scambled Quotations are not a problem of my Mailclient - so I put it here again better formatted... I would be really happy if anyone had a clue. Regards Mario Am 28.06.2013 18:08, schrieb Mario van der Linde: [...]> 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 } 12 } > > 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?- -- Mario van der Linde Linux Consultant & Trainer Tel.: +49-151-16879485 Mail: linde@b1-systems.de 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/ iEYEARECAAYFAlHRKq0ACgkQ0xt2iESAuwRc7ACeKIHZWU4FE91O3Hukc/a6uQkI FwAAn3u1mxbb/eFcwZBgmaPWi49ANlVs =kmZf -----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 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.
linde.mvdl@gmail.com
2013-Jul-01 07:10 UTC
Re: [Puppet Users] Scope variable name is a NilClass
Once again... 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 } 12 } -- 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.
that should be <%= scope.lookupvar(''var'') %>, note the quotes around var. On 1 July 2013 09:10, <linde.mvdl@gmail.com> wrote:> > Once again... > > > 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 } > 12 } > > > -- > 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. > > >-- Erik Dalén -- 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.
Mario van der Linde
2013-Jul-01 15:01 UTC
[Puppet Users] [Solved] Scope variable name is a NilClass
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thank you, thats it! :) Am 01.07.2013 16:34, schrieb Erik Dalén:> that should be <%= scope.lookupvar(''var'') %>, note the quotes > around var. > > > On 1 July 2013 09:10, <linde.mvdl@gmail.com > <mailto:linde.mvdl@gmail.com>> wrote: > > > Once again... > > > 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 } 12 > } > > > -- 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 > <mailto:puppet-users%2Bunsubscribe@googlegroups.com>. To post to > this group, send email to puppet-users@googlegroups.com > <mailto: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. > > > > > > > -- Erik Dalén > > -- 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. > >- -- Mario van der Linde Linux Consultant & Trainer Tel.: +49-151-16879485 Mail: linde@b1-systems.de 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/ iEYEARECAAYFAlHRmccACgkQ0xt2iESAuwQacQCgmwLXLmkx/E+5b6vGOXN7xkGV 42wAoI2lXe4gP3UZhH08s2XS1bj8UXX5 =PvP/ -----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 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.