ssh commands file
This commit is contained in:
parent
24dd007f2c
commit
90d0630ca2
14
devops-service/commands/ssh.rb
Normal file
14
devops-service/commands/ssh.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
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
|
||||||
Loading…
Reference in New Issue
Block a user