lib/puppet-ghostbuster/puppetdb.rb in puppet-ghostbuster-0.8.0 vs lib/puppet-ghostbuster/puppetdb.rb in puppet-ghostbuster-0.9.0
- old
+ new
@@ -2,11 +2,11 @@
class PuppetGhostbuster
class PuppetDB
def self.client
@@client ||= ::PuppetDB::Client.new({
- :server => "#{ENV['PUPPETDB_URL'] || 'http://puppetdb:8080'}/pdb/query",
+ :server => "#{ENV['PUPPETDB_URL'] || 'http://puppetdb:8080'}",
:pem => {
'key' => ENV['PUPPETDB_KEY_FILE'],
'cert' => ENV['PUPPETDB_CERT_FILE'],
'ca_file' => ENV['PUPPETDB_CACERT_FILE'],
}
@@ -16,13 +16,21 @@
def client
self.class.client
end
def self.classes
- @@classes ||= client.request('resources', [:'=', 'type', 'Class']).data.map { |r| r['title'] }.uniq
+ @@classes ||= client.request('', 'resources[title] { type = "Class" and nodes { deactivated is null } }').data.map { |r| r['title'] }.uniq
end
def classes
self.class.classes
+ end
+
+ def self.resources
+ @@resources ||= client.request('', 'resources[type] { nodes { deactivated is null } }').data.map { |r| r['type'] }.uniq
+ end
+
+ def resources
+ self.class.resources
end
end
end