Skip to content

Instantly share code, notes, and snippets.

@reset
Created March 11, 2013 00:30
Show Gist options
  • Save reset/5131168 to your computer and use it in GitHub Desktop.
Save reset/5131168 to your computer and use it in GitHub Desktop.
class Something
include Celluloid
def ruby_script(name, host, options = {})
name = name.split('.rb')[0]
script = File.read(MB.scripts.join("#{name}.rb"))
command = "#{EMBEDDED_RUBY_PATH} -e '#{script}'"
status, response = ssh_command(host, command, options)
case status
when :ok
response.stdout.chomp
when :error
abort RemoteScriptError.new(response.stderr.chomp)
end
end
def node_name(host, options = {})
ruby_script('node_name', host, options)
rescue RemoteScriptError
nil
end
end
class Worker
include Celluloid
def initialize
@something = Something.new
end
def nodes
f = @something.future(:node_name, "hello.local")
f.value # expect nil but get RemoteScriptError
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment