lib/cluster_chef/server_slice.rb
# Helper methods for iterating through the servers to do things
Helper methods for iterating through the servers to do things
Helper methods for iterating through the servers to do things
def delegate_to_servers method, threaded = false
      if threaded
        threads = servers.map{|svr| Thread.new(svr) { |s| s.send(method) } }
        threads.map{|t| t.join.value }
      else
        servers.map{|svr| svr.send(method) }
      end
    end
def delegate_to_servers method , threaded = false if threaded threads = servers . map { | svr | Thread . new ( svr ) { | s | s . send ( method ) } } threads . map { | t | t . join . value } else servers . map { | svr | svr . send ( method ) } end end
Helper methods for iterating through the servers to do things
Helper methods for iterating through the servers to do things
# Execute across all servers in parallel # Wait for the threads to finish and return the array of results # Call the method for each server sequentially # and return the results in an array
method
threaded