Method: Arachni::RPC::Server::Framework::Master#enslave
- Defined in:
- lib/arachni/rpc/server/framework/master.rb
#enslave(instance_info, &block) ⇒ Bool
Enslaves another instance and subsequently becomes the master of the group.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/arachni/rpc/server/framework/master.rb', line 65 def enslave( instance_info, &block ) # Slaves can't have slaves of their own. if slave? block.call false return false end instance_info = instance_info.my_symbolize_keys fail "Instance info does not contain a 'url' key." if !instance_info[:url] fail "Instance info does not contain a 'token' key." if !instance_info[:token] # Since we have slaves we must be a master. set_as_master # Take charge of the Instance we were given. instance = connect_to_instance( instance_info ) instance..set( ) do instance.framework.set_master( multi_self_url, token ) do @slaves << instance_info print_status "Enslaved: #{instance_info[:url]}" block.call true if block_given? end end true end |