0

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

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

Olive
  • 25
  • 2
  • 5

2 Answers2

0

I think you are referencing the variable in a wrong way.

[0] % puppet --version
4.3.2

% puppet apply -e 'notice(inline_template("<%= $::fqdn =>"))'
Notice: Scope(Class[main]):  nb.localnetwork.intra =>
Notice: Compiled catalog for nb.localnetwork.intra in environment production in 0.05 seconds
Notice: Applied catalog in 0.04 seconds
c4f4t0r
  • 5,301
  • 3
  • 31
  • 42
0

its problem with inline_template function. I changed it to inline_epp and my test case passed.

Olive
  • 25
  • 2
  • 5