On 2019-02-28 13:37, Dirk Heinrichs wrote:
Hi,
following the example in the PuppetDB documentation, I tried this code:
$debian_nodes_query = 'nodes[certname]{facts{name = "operatingsystem"
and value = "Debian"}}'
$debian_nodes = puppetdb_query($debian_nodes_query).each |$value| {
The line above is wrong - you are using each() and it returns its input.
Did you mean to use map() to get an array of the names? That is, like this:
$debian_nodes = puppetdb_query($debian_nodes_query).map |$value| {
$value["certname"]
}
- henrik
$value["certname"] }
Notify {"Debian nodes":
message => "Your debian nodes are ${join($debian_nodes, ', ')}",
}
which prints:
Notice: Your debian nodes are {"certname"=>"host1.example.com"},
{"certname"=>"host2.example.com"}
despite the '$value["certname"]'. What would I need to do to print the
names only? Like:
Notice: Your debian nodes are host1.example.com, host2.example.com
which is what I would expect the code above to do in the first place.
Thanks...
Dirk
--
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
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/q58ll0%24658f%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.