Skip to content

Commit

Permalink
F #3099 Show container log when action fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dann1 authored and Ruben S. Montero committed Mar 25, 2019
1 parent 31a1cb9 commit 43e4212
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/vmm_mad/remotes/lib/lxd/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ def exec(command)
Command.execute(cmd, true)
end

def show_log
cmd = "#{@lxc_command} info --show-log #{@lxc['name']}"
rc, o, e = Command.execute(cmd, false)

if rc.zero?
OpenNebula.log o
else
OpenNebula.log_error e
end
end

#---------------------------------------------------------------------------
# Contianer Status Control
#---------------------------------------------------------------------------
Expand Down Expand Up @@ -406,6 +417,9 @@ def del_bridge_port(nic)
# Waits or no for response depending on wait value
def wait?(response, wait, timeout)
@client.wait(response, timeout) unless wait == false
rescue LXDError => e
show_log
raise e
end

# Performs an action on the container that changes the execution status.
Expand Down

0 comments on commit 43e4212

Please sign in to comment.