Convert single quoted string to double quoted for interpolation

24 views
Skip to first unread message

Vlados Vladosov

unread,
Mar 16, 2013, 8:54:09 PM3/16/13
to puppet...@googlegroups.com
Please help, how convert single quoted string to double quoted for interpolation:

$conf = '${domain}xxxx/${hostgroup}yyyyyy/${fqdn}zzz/ZendOptimizerPlus.ini'


Thanks.

Vlados Vladosov

unread,
Mar 17, 2013, 6:18:24 AM3/17/13
to puppet...@googlegroups.com
I found solution:

--- 
environment: development
classes: 
    php: 
        source_dir: "${domain}"

init.pp

class php (
  $source_dir          = params_lookup( 'source_dir' ),
) {


   $conf = regsubst($php::source_dir, '\$\{', '#{', 'G')
   $conf1 = inline_template("<%= %Q($php::conf) %>"
    notify{"test $php::conf1":}

}

output:

Notice: test fabrik.test
Notice: /Stage[main]/Php/Notify[test fabrik.test]/message: defined 'message' as 'test fabrik.test'
Notice: Finished catalog run in 0.82 seconds


воскресенье, 17 марта 2013 г., 4:54:09 UTC+4 пользователь Vlados Vladosov написал:
Reply all
Reply to author
Forward
0 new messages