Module: BoPeep::HostCollection::Interaction
- Included in:
- BoPeep::HostCollection, LazilyFilteredHostCollection
- Defined in:
- lib/bopeep.rb
Instance Method Summary collapse
- #create_file_from(content, path:, mode: 0644) ⇒ Object
- #download(path) ⇒ Object
- #run(order:, &block) ⇒ Object
- #run_command(command, order: :parallel, callbacks: nil, log: false, &setup) ⇒ Object
- #run_script(script, order: :parallel, callbacks: nil, log: false, &setup) ⇒ Object
- #upload(file, to:) ⇒ Object
Instance Method Details
#create_file_from(content, path:, mode: 0644) ⇒ Object
1273 1274 1275 1276 1277 |
# File 'lib/bopeep.rb', line 1273 def create_file_from(content, path:, mode: 0644) each do |host| host.create_file_from(content, path: path, mode: mode) end end |
#download(path) ⇒ Object
1285 1286 1287 1288 1289 |
# File 'lib/bopeep.rb', line 1285 def download(path) map do |host| host.download(path) end end |
#run(order:, &block) ⇒ Object
1303 1304 1305 1306 1307 |
# File 'lib/bopeep.rb', line 1303 def run(order:, &block) strategy = Executor.for(order) executor = strategy.new(self) executor.run(&block) end |
#run_command(command, order: :parallel, callbacks: nil, log: false, &setup) ⇒ Object
1297 1298 1299 1300 1301 |
# File 'lib/bopeep.rb', line 1297 def run_command(command, order: :parallel, callbacks: nil, log: false, &setup) run(order: order) do |host, result| result.update host.run_command(command, callbacks: callbacks, log: log, &setup) end end |
#run_script(script, order: :parallel, callbacks: nil, log: false, &setup) ⇒ Object
1291 1292 1293 1294 1295 |
# File 'lib/bopeep.rb', line 1291 def run_script(script, order: :parallel, callbacks: nil, log: false, &setup) run(order: order) do |host, result| result.update host.run_script(script, callbacks: callbacks, log: log, &setup) end end |
#upload(file, to:) ⇒ Object
1279 1280 1281 1282 1283 |
# File 'lib/bopeep.rb', line 1279 def upload(file, to:) each do |host| host.upload(file, to: to) end end |