On 2018-07-09 18:12, Suresh P wrote:
> Hi,
>
> I used following code in puppet3.8.x, it worked well.
>
> After i migrated to Puppet5 it throws error.
>
> $header="LD_LIBRARY_PATH=$destdir:\$LD_LIBRARY_PATH\n\nexport
> LD_LIBRARY_PATH\n"
> $content = inline_template('<%= header+"\n"+ports.map {|port|
> memcache_command+" -m "+memory_per_instance+" -p "+port+"
> &"}.join("\n")+"\n" %>')
> file { "$destdir/startmemcached.sh":
> ensure => file,
> owner => $title,
> group => $title,
> mode => '0744',
> content => inline_template($content),
> }
>
You need neither inline_template nor inline_epp - you can do that
transformation directly in puppet. (Untested rewrite - pardon typos):
$header = "LD_LIBRARY_PATH=$destdir:\$LD_LIBRARY_PATH\n\nexport
LD_LIBRARY_PATH\n"
$format = "${memcache_command} -m ${memory_per_instance} -p %s &"
$entries = $ports.map |$port| { sprintf($format, $port) }.join("\n")
file { "$destdir/startmemcached.sh":
ensure => file,
owner => $title,
group => $title,
mode => '0744',
content => "${header}\n${entries}\n"
}
Hope that is of value,
Best,
- henrik