Created
March 11, 2013 00:30
-
-
Save reset/5131168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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