Hi all,
I had this strange thing regarding to puppetdb_query. I am trying to experence PQL.What I do was to create a simple test module that has these content,
class test {
$debian_nodes_query = 'nodes[certname]{facts{name = "operatingsystem" and value = "Debian"}}'
$debian_nodes = puppetdb_query($debian_nodes_query).map |$value| { $value["certname"] }
notify {"Debian nodes":
message => "Your debian nodes are ${join($debian_nodes, ', ')}",
}
$last_node_query = "nodes[certname] { certname ~ 'hadoop.*worker-.*' order by certname}"
# $last_node_query = "certname in nodes[certname] { facts[certname] { name = 'icebrg_hadoop_group' and value = 'shakedown_test' } group by certname order by certname }"
$latest_node = puppetdb_query($last_node_query)
Notify {"hello PQL":
message => "My last report was from $latest_node.",
}
}
While the above module was able to successfully execute from puppet master. It failed on one of my agents with the following complain,
Error: Evaluation Error: Unknown function: 'puppetdb_query'. (file: /tmp/test/manifests/init.pp, line: 3, column: 19) on node xxx
I found on the puppet master side, these components exists
/opt/puppetlabs/puppet/cache/lib/puppet/provider/puppetdb_conn_validator/puppet_https.rb
/opt/puppetlabs/puppet/cache/lib/puppet/type/puppetdb_conn_validator.rb
/opt/puppetlabs/puppet/cache/lib/puppet/util/puppetdb_validator.rb
/opt/puppetlabs/puppet/cache/lib/puppetdb/astnode.rb
/opt/puppetlabs/puppet/cache/lib/puppetdb/connection.rb
/opt/puppetlabs/puppet/cache/lib/puppetdb/grammar.racc
/opt/puppetlabs/puppet/cache/lib/puppetdb/lexer.rb
/opt/puppetlabs/puppet/cache/lib/puppetdb/lexer.rex
/opt/puppetlabs/puppet/cache/lib/puppetdb/parser.rb
/opt/puppetlabs/puppet/cache/lib/puppetdb/parser_helper.rb
But they are not exist on the agent side. Anyone can help me on this?
Thanks,
Chengkai