fluke/devops-service/commands/ssh.rb

15 lines
342 B
Ruby
Raw Normal View History

2014-05-23 17:59:06 +04:00
module SshCommands
def ssh_test server, params
res, code = ssh_execute(server, "test #{params}")
code == 0
end
def ssh_execute server, cmd
key_path = File.join(DevopsCid.config[:keys_dir], server[:private_key])
res = `ssh -i #{key_path} #{server[:remote_user]}@#{server[:host]} '#{cmd}'`
return res, $?
end
end