Closed arioch closed 9 years ago
@arioch if you are using it from another script use the scheduler class which include's the DSL. like this,
require 'blender'
list = %w(host1 host2 host3)
Blender.blend('test') do |sched|
sched.ssh_task 'update' do
execute 'sudo apt-get update'
members list
end
sched.ssh_task 'upgrade' do
execute 'sudo apt-get upgrade -y'
members list
end
end
if you want to run a standalone job, you can use the script that you have specified , via `blend -f /path/to/file', just remove the require and include statement.
Just what I was looking for! Thanks!
Maybe just one more question, I couldn't find this in the docs either... Is there a way to retrieve the exit status for each host?
At the moment I'm using Net::SSH with exceptions to accomplish this. However I'm looking for something that allows parallel execution.
currently not. for ssh_task non-zero exit code will raise ExecutionFailed exception, which can be controlled by the ignore_failure
attribute. Ignore failure is available per task or globally. If you want to tap in to failed jobs and run some code, look at the event handlers. you can add failure specific custom handler with the on
DSL method.
on :job_failed do |job, error|
# your code goes here
end
@arioch im closing this due to inactivity, feel free to raise another issue if you have any queries
What's the preferred way to run Blender tasks from plain Ruby or Rake instead of using the Thor DSL? I'd like to integrate Blender in a different project. This is what I have so far but I'm running into errors.
Thanks in advance!