dalen / puppet-puppetdbquery

Query functions for PuppetDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby example broken?

arioch opened this issue · comments

Unless I've missed a step along the way the Ruby example in the readme file is
broken on Puppet 4.3.0 / PuppetDB 3.2.0.

# rpm -qa | grep -iE ^puppet
puppet-agent-1.2.7-1.el7.x86_64
puppetlabs-release-pc1-1.0.0-1.el7.noarch
puppetdb-3.2.0-1.el7.noarch
puppetdb-termini-3.2.0-1.el7.noarch
puppetserver-2.1.2-1.el7.noarch

# bundle exec gem search --local

*** LOCAL GEMS ***

bundler (1.10.6)
facter (2.4.4)
hiera (3.0.5)
httparty (0.13.7)
json (1.8.3)
json_pure (1.8.3)
multi_xml (0.5.5)
puppet (4.3.0)
# bundle exec irb
irb(main):001:0> require 'puppet/face'
=> true
irb(main):002:0> Puppet.initialize_settings
=> [:debug, :info, :notice, :warning, :err, :alert, :emerg, :crit]
irb(main):003:0> Puppet::Face[:query, :current].nodes('(Package["mysql-server"] and architecture=amd64)')
Puppet::Error: Could not find Puppet Face query
    from /usr/local/share/gems/gems/puppet-4.3.0/lib/puppet/interface.rb:100:in `[]'
    from (irb):3
    from /usr/bin/irb:12:in `<main>'
irb(main):004:0>

Any advice how to proceed?

You need the puppetdb-terminus installed. But unfortunately that isn't gem packaged in any good way, see https://projects.puppetlabs.com/issues/16529

That being said, in the spec tests for this module I mock the necessary bits from puppetdb-terminus to make it work. Check the spec for to see the details.