On Wed, Jun 01, 2016 at 05:34:59PM +0200, Henrik Lindberg wrote:
> First check what you get in puppet with a simple manifest:
> 
> notice($facts)

$ sudo puppet apply -e 'notify{"${os}":}'
Notice: Compiled catalog for host in environment production in 0.02 seconds
Notice: {"name"=>"CentOS", "family"=>"RedHat", "release"=>{"major"=>"7", 
"minor"=>"2", "full"=>"7.2.1511"}, "lsb"=>{"distcodename"=>"Core", 
"distid"=>"CentOS", "distdescription"=>"CentOS Linux release 7.2.1511 (Core) ", 
"release"=>":core-4.1-amd64:core-4.1-noarch", "distrelease"=>"7.2.1511", 
"majdistrelease"=>"7", "minordistrelease"=>"2"}}
Notice: /Stage[main]/Main/Notify[{"name"=>"CentOS", "family"=>"RedHat", 
"release"=>{"major"=>"7", "minor"=>"2", "full"=>"7.2.1511"}, 
"lsb"=>{"distcodename"=>"Core", "distid"=>"CentOS", "distdescription"=>"CentOS 
Linux release 7.2.1511 (Core) ", "release"=>":core-4.1-amd64:core-4.1-noarch", 
"distrelease"=>"7.2.1511", "majdistrelease"=>"7", 
"minordistrelease"=>"2"}}]/message: defined 'message' as '{"name"=>"CentOS", 
"family"=>"RedHat", "release"=>{"major"=>"7", "minor"=>"2", 
"full"=>"7.2.1511"}, "lsb"=>{"distcodename"=>"Core", "distid"=>"CentOS", 
"distdescription"=>"CentOS Linux release 7.2.1511 (Core) ", 
"release"=>":core-4.1-amd64:core-4.1-noarch", "distrelease"=>"7.2.1511", 
"majdistrelease"=>"7", "minordistrelease"=>"2"}}'
Notice: Finished catalog run in 0.70 seconds
$ sudo puppet apply -e 'notify{"foo ${facts}":}'
Notice: Compiled catalog for host in environment production in 0.03 seconds
Notice: foo
Notice: /Stage[main]/Main/Notify[foo ]/message: defined 'message' as 'foo '
Notice: Finished catalog run in 0.81 seconds
$ sudo puppet --version
3.8.6

Unfortunately, I cannot see here whether ${os} is actually a string,
can I?

$ sudo puppet apply -e '$myhash={ key1 => 'val1', key2 => 'val2' } notify{"foo 
${myhash}":}'
Notice: Compiled catalog for host in environment production in 0.08 seconds
Notice: foo {"key1"=>"val1", "key2"=>"val2"}
Notice: /Stage[main]/Main/Notify[foo {"key1"=>"val1", "key2"=>"val2"}]/message: 
defined 'message' as 'foo {"key1"=>"val1", "key2"=>"val2"}'
Notice: Finished catalog run in 0.71 seconds
$ sudo puppet apply -e '$mystring="{\"key1\"=>\"val1\", \"key2\"=>\"val2\"}" 
notify{"foo ${mystring}":}'
Notice: Compiled catalog for host in environment production in 0.03 seconds
Notice: foo {"key1"=>"val1", "key2"=>"val2"}
Notice: /Stage[main]/Main/Notify[foo {"key1"=>"val1", "key2"=>"val2"}]/message: 
defined 'message' as 'foo {"key1"=>"val1", "key2"=>"val2"}'
Notice: Finished catalog run in 0.72 seconds
1.pportal|e13itfe@jira01 ~ $

Is ${os} now a string or not?

And, why is ${facts} obviously empty?

> If all the data elements are strings, turn off stringify_facts - it flattens
> data and makes all facts be strings.

I cannot do this in the production without excessive coordinative
effort. The colleagues managing the master side say that haven't
explicitly configured that settings and are going to stay with the
default.

> If you can, hop on to the puppet slack or IRC channels to get more help from
> community members - always easier interactively.

I am reluctant to discuss configuration snippets on IRC and currently
cannot guarantee timely answers. And, I am trying to cut down on the
number of IRC channels I am on ;-)  But I'll think about it.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20160602072200.GA14027%40torres.zugschlus.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to