Handle ssh attempt to VM that is down
This commit is contained in:
parent
16f88d4401
commit
a21bf2c215
@ -147,8 +147,10 @@ def read_vm_dominfo(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def read_vm_info(name)
|
def read_vm_info(name)
|
||||||
ssh_out = `ssh -Ti /root/.ssh/malp-vm-key malp@#{name}`
|
ssh_out = `ssh -o ConnectTimeout=1 -Ti /root/.ssh/malp-vm-key malp@#{name} 2>/dev/null`
|
||||||
JSON.parse(ssh_out)
|
if ssh_out != ""
|
||||||
|
JSON.parse(ssh_out)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_virtual_machines
|
def read_virtual_machines
|
||||||
@ -159,7 +161,7 @@ def read_virtual_machines
|
|||||||
|
|
||||||
names.map do |name|
|
names.map do |name|
|
||||||
dom_info = read_vm_dominfo(name)
|
dom_info = read_vm_dominfo(name)
|
||||||
vm_info = read_vm_info(name)
|
vm_info = read_vm_info(name) || {}
|
||||||
{
|
{
|
||||||
"type" => "vm",
|
"type" => "vm",
|
||||||
"name" => name,
|
"name" => name,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user