Module: Warg::HostCollection::Interaction
- Included in:
- Warg::HostCollection, LazilyFilteredHostCollection
- Defined in:
- lib/warg.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, &setup) ⇒ Object
- #run_script(script, order: :parallel, &setup) ⇒ Object
- #upload(file, to:) ⇒ Object
Instance Method Details
#create_file_from(content, path:, mode: 0644) ⇒ Object
1177 1178 1179 1180 1181 |
# File 'lib/warg.rb', line 1177 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
1189 1190 1191 1192 1193 |
# File 'lib/warg.rb', line 1189 def download(path) map do |host| host.download(path) end end |
#run(order:, &block) ⇒ Object
1207 1208 1209 1210 1211 |
# File 'lib/warg.rb', line 1207 def run(order:, &block) strategy = Executor.for(order) executor = strategy.new(self) executor.run(&block) end |
#run_command(command, order: :parallel, &setup) ⇒ Object
1201 1202 1203 1204 1205 |
# File 'lib/warg.rb', line 1201 def run_command(command, order: :parallel, &setup) run(order: order) do |host, result| result.update host.run_command(command, &setup) end end |
#run_script(script, order: :parallel, &setup) ⇒ Object
1195 1196 1197 1198 1199 |
# File 'lib/warg.rb', line 1195 def run_script(script, order: :parallel, &setup) run(order: order) do |host, result| result.update host.run_script(script, &setup) end end |
#upload(file, to:) ⇒ Object
1183 1184 1185 1186 1187 |
# File 'lib/warg.rb', line 1183 def upload(file, to:) each do |host| host.upload(file, to: to) end end |