class Pupmin::Nodes
Node/Agent grouping and other informational helpers
Public Class Methods
all()
click to toggle source
Simple list all nodes by fqdn values
# File lib/pupmin/nodes.rb, line 5 def self.all puppetdb = Pupmin::PuppetDB.build nodes = [] puppetdb.request('facts', ['=', 'name', 'fqdn']).data.each do |x| nodes.push(x['value']) end nodes end
deactivate(certname)
click to toggle source
# File lib/pupmin/nodes.rb, line 25 def self.deactivate(certname) pdb = Pupmin::PuppetDB.build rsp = pdb.command('deactivate node', {'certname' => certname, 'producer_timestamp' => Pupmin::Util.make_timestamp}, 3) rsp.data end
random(num = 5)
click to toggle source
Display a random number of hosts
# File lib/pupmin/nodes.rb, line 15 def self.random(num = 5) rand_hosts = [] all_hosts = all().shuffle! # hosts.shuffle! num.to_i.times do rand_hosts.push(all_hosts.shift) end rand_hosts end