Ask Your Question
0

Failed to parse inline template: undefined local variable or method

asked 2016-06-23 05:02:22 -0500

Chutki gravatar image

updated 2016-06-23 05:02:53 -0500

Hi,

I have below manifests for disk iteration

class my_module::filesystem {

  include 'my_module::params'

  my_module::recursion { 'start':
    fssize => '0',
    disk   => $my_module::params::count,
  }
}
include my_module::filesystem

below is the define class, used custom function to iterate

define my_module::recursion($fssize,$disk) {

 $app = inline_template("<%= fssize.to_i + 1 %>")

 file { "/grid/0${app}" :
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
      }

 my_module::recursion { "count+${app}":
      fssize => $app,
      disk   => $disk,
    }
}

when I run the manifests getting below error,

puppet apply -t --noop filesystem.pp

Info: Loading facts
Info: Loading facts
Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, 
Failed to parse inline template: undefined local variable or method `fssize' for #<Puppet::Parser::TemplateWrapper:0x0000000375d188> at 
/etc/puppetlabs/code/environments/production/modules/my_module/manifests/recursion.pp:2 
 at /etc/puppetlabs/code/environments/production/modules/my_module/manifests/filesystem.pp:5 on node myserver.master.com

The above manifests imported form puppet 3.8 and currently the manifests is testing in puppet 2015.3.1

edit retag flag offensive close merge delete

Comments

Anybody got an opportunity to look at this issue.

Chutki gravatar imageChutki ( 2016-06-24 02:58:13 -0500 )edit

cat test1.pp class my_module::test1{ my_module::test2{ 'count': number => 0 } } include my_module::test1 cat test2.pp define my_module::test2(Integer $number) { $add1 = inline_template("<%= number.to_i + 1 %>") notify{ "$add1test": } }, I tried these two manifests but still getting same error.

Chutki gravatar imageChutki ( 2016-06-28 01:03:20 -0500 )edit

Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Failed to parse inline template: undefined local variable or method `number' for #<puppet::parser::templatewrapper:0x0000000364ae08> at /etc/puppetlabs/code/environments/p

Chutki gravatar imageChutki ( 2016-06-28 01:09:00 -0500 )edit

My doubt is puppet 2015 doesn't support "inline_template"

Chutki gravatar imageChutki ( 2016-06-28 01:09:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-01 04:33:30 -0500

Chutki gravatar image

Hi, The problem with" inlinetemplate" function. I changed it to "inlineepp("<%= @fssize + 1 %>")" and my test case passed.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-23 05:02:22 -0500

Seen: 411 times

Last updated: Jul 01 '16