Top Level Namespace
Defined Under Namespace
Modules: Generators, Kernel, Nagios, PSON, Puppet, RDoc, SignalEmitter, SignalEmitterModule, SignalObserver
Classes: AddCreatedAtToAllTables, AddEnvironmentToHost, AddInventoryServiceTables, Base64, Class, DefineAccessorsTest, EventLoop, ExternalNode, File, Formatter, Hash, IO, ImmutableAttributeError, Module, MyExternalNode, NilClass, Object, RemoveDuplicatedIndexOnAllTables, RequestPool, SignalEmitterTest, Symbol, TimerTest, TypeDoc, UserAttr
Constant Summary
collapse
- SignalEmitterClass =
This is an old name for the same thing.
SignalEmitterModule
- BASEDIR =
Dir.chdir(File.dirname(__FILE__) + "/..") { Dir.getwd }
- WORKINGDIR =
paths for files we use will be relative to this directory
XXX flip this for production vs local sandbox
WORKINGDIR = "/var/lib/puppet/bin"
Dir.pwd
Instance Method Summary
collapse
Instance Method Details
350
351
352
353
354
355
356
357
358
|
# File 'ext/puppet-load.rb', line 350
def format_bytes(bytes)
if bytes < 1024
"%.2f B" % bytes
elsif bytes < 1024 * 1024
"%.2f KiB" % (bytes/1024.0)
else
"%.2f MiB" % (bytes/(1024.0*1024.0))
end
end
|
#mean(array) ⇒ Object
340
341
342
|
# File 'ext/puppet-load.rb', line 340
def mean(array)
array.inject(0) { |sum, x| sum += x } / array.size.to_f
end
|
344
345
346
347
348
|
# File 'ext/puppet-load.rb', line 344
def median(array)
array = array.sort
m_pos = array.size / 2
return array.size % 2 == 1 ? array[m_pos] : mean(array[m_pos-1..m_pos])
end
|
#printusage(error_code) ⇒ Object
13
14
15
16
17
18
|
# File 'ext/puppetstoredconfigclean.rb', line 13
def printusage(error_code)
puts "Usage: #{$0} [ list of hostnames as stored in hosts table ]"
puts "\n Options:"
puts "--config <puppet config file>"
exit(error_code)
end
|
#read_facts(file) ⇒ Object
159
160
161
162
|
# File 'ext/puppet-load.rb', line 159
def read_facts(file)
Puppet.debug("reading facts from: #{file}")
fact = YAML.load(File.read(file))
end
|
#read_node(node) ⇒ Object
Read in a pure yaml representation of our node.
56
57
58
59
60
61
62
63
|
# File 'ext/yaml_nodes.rb', line 56
def read_node(node)
nodefile = File.join(YAMLDIR, "#{node}.yaml")
if FileTest.exist?(nodefile)
return YAML.load_file(nodefile)
else
raise "Could not find information for #{node}"
end
end
|