Hi,

thanks for your answers. They're helpful.

On Thu, Jun 02, 2016 at 02:42:17PM +0200, Henrik Lindberg wrote:
> On 02/06/16 09:22, Marc Haber wrote:
> >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?
> >
> 
> When you notice ${os} it turns the value into the printed string. That
> string looks like a hash, so you are indeed seeing a structure value where
> you should be able to access $os[name] etc.

How would it look like if ${os} were actually a hash?

> >$ 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?
> 
> There is no mention of ${os} in that snippet

Misleading question. The snipped was to find out how a notified hash
looks like and a notified string that looks like a stringyfied hash.
There seems to be no difference.

> >And, why is ${facts} obviously empty?
> >
> 
> By default, $facts is an opt in before 4.0 and did not exist before 3.5.0.

I missed the part that it's default off in pre 4.0.

> In almost every case it is ok to turn on support for $facts. It only breaks
> something if you already have global variables that clash (very unlikely).

Opened a local ticket.

Thanks agan.

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20160602125842.GJ14027%40torres.zugschlus.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to