Use facts in smart-variable values

Hello.
I found how interpolate string!!!
This maybe useful for example42
foreman yaml:

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

понедельник, 26 ноября 2012 г., 22:06:36 UTC+4 пользователь Florian Sachs написал:

Hi!

Can I use facts a values for parametrized classes?

Here my scenario:
I have a class, where the default value of a class is $hostname. For a
some hosts, I want to override it.

When I import the class, in Foreman it defaults to ${$hostname}. When I
click on override, the resulting YAML file für the ENC contains the string
${$hostname}, which is then used within the manifests without being
interpolated.*
*
I tried anything, at least a lot of things, as default value ($hostname,
$$hostname, ${hostname}), but I always results in this specific string
within the manifest and not the value of the fact. *

Is this possible with foreman?

best regards,
florian*
*

ForemanVersion: 1.0.1-7 - RPM Package from 2012-11-21, devel-yum
repository - everything installed via rpm
Platform: RedHat 6.3 x86_64
Postgresql: 9.2
Puppet: 3.0.1