Class: PoolParty::Pool
Instance Attribute Summary collapse
-
#auto_execute ⇒ Object
Returns the value of attribute auto_execute.
-
#debugging ⇒ Object
Returns the value of attribute debugging.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#very_debugging ⇒ Object
Returns the value of attribute very_debugging.
-
#very_verbose ⇒ Object
Returns the value of attribute very_verbose.
Attributes inherited from Base
Instance Method Summary collapse
-
#chef_step(name = nil) ⇒ Object
Description.
- #cloud(name, &block) ⇒ Object
- #clouds ⇒ Object
-
#cmd(commands, opts = {}) ⇒ Object
Run command/s on all nodes in the pool.
- #run ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Base
#after_initialized, #initialize, #method_missing
Constructor Details
This class inherits a constructor from PoolParty::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PoolParty::Base
Instance Attribute Details
#auto_execute ⇒ Object
Returns the value of attribute auto_execute.
4 5 6 |
# File 'lib/poolparty/pool.rb', line 4 def auto_execute @auto_execute end |
#debugging ⇒ Object
Returns the value of attribute debugging.
4 5 6 |
# File 'lib/poolparty/pool.rb', line 4 def debugging @debugging end |
#verbose ⇒ Object
Returns the value of attribute verbose.
4 5 6 |
# File 'lib/poolparty/pool.rb', line 4 def verbose @verbose end |
#very_debugging ⇒ Object
Returns the value of attribute very_debugging.
4 5 6 |
# File 'lib/poolparty/pool.rb', line 4 def very_debugging @very_debugging end |
#very_verbose ⇒ Object
Returns the value of attribute very_verbose.
4 5 6 |
# File 'lib/poolparty/pool.rb', line 4 def very_verbose @very_verbose end |
Instance Method Details
#chef_step(name = nil) ⇒ Object
Description
Set / Get the chef_step which will be executed on the remote host
42 43 44 45 46 47 48 |
# File 'lib/poolparty/pool.rb', line 42 def chef_step name = nil @selected_chef_step ||= :default if name @selected_chef_step = name.to_sym end @selected_chef_step end |
#cloud(name, &block) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/poolparty/pool.rb', line 6 def cloud(name, &block) c = Cloud.new(name.to_s, {:parent => self}, &block) clouds[name.to_s] = c # Create a dummy security group for tagging purposes. Do not want to # conflict with advance usage of security groups c.security_group "#poolparty-#{c.proper_name}" end |
#clouds ⇒ Object
14 15 16 |
# File 'lib/poolparty/pool.rb', line 14 def clouds @clouds ||= {} end |
#cmd(commands, opts = {}) ⇒ Object
Run command/s on all nodes in the pool. Returns a hash in the form of => [{instance_id=>result]}
20 21 22 23 24 25 26 27 |
# File 'lib/poolparty/pool.rb', line 20 def cmd(commands, opts={}) results = {} threads = clouds.collect do |name, c| Thread.new{ results[ name ] = c.cmd(commands, opts) } end threads.each{ |aThread| aThread.join } results end |
#run ⇒ Object
50 51 52 53 54 55 |
# File 'lib/poolparty/pool.rb', line 50 def run clouds.each do |cloud_name, cld| puts "----> Starting to build cloud #{cloud_name}" cld.run end end |
#to_hash ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/poolparty/pool.rb', line 57 def to_hash c = clouds.collect do |cloud_name, cld| nodes = cld.nodes.collect do |node| h = {} [:dns_name, :private_ip, :public_ip].each do |f| h[f] = node[f] end h end { cloud_name => nodes } end h = c.inject({})do |old, new| old.merge! new end {:clouds => h } end |