FAQ
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: 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


--
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.

Search Discussions

  • Mario van der Linde at Jul 1, 2013 at 7:07 am
    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


    --
    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 at Jul 1, 2013 at 2:32 pm
    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 at Jul 1, 2013 at 2:34 pm
    that should be <%= scope.lookupvar('var') %>, note the quotes around var.

    On 1 July 2013 09:10, 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 at Jul 1, 2013 at 3:01 pm
    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, 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
    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


    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 28, '13 at 4:18p
activeJul 1, '13 at 3:01p
posts5
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2021 Grokbase