Skip to content

Commit

Permalink
Merge pull request #51 from aliksend/master
Browse files Browse the repository at this point in the history
Get error from kubernetes response
  • Loading branch information
ltamaster authored Nov 21, 2019
2 parents a7f7996 + 471db0c commit 19bf9d1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion contents/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,16 @@ def run_interactive_command(name, namespace, container, command):
print("%s" % resp.read_stdout())
if resp.peek_stderr():
log.error("%s" % resp.read_stderr())
error = True

ERROR_CHANNEL = 3
err = api.api_client.last_response.read_channel(ERROR_CHANNEL)
err = yaml.safe_load(err)
if err['status'] != "Success":
log.error('Failed to run command')
log.error('Reason: ' + err['reason'])
log.error('Message: ' + err['message'])
log.error('Details: ' + ';'.join(map(lambda x: json.dumps(x), err['details']['causes'])))
error = True

return (resp,error)

Expand Down

0 comments on commit 19bf9d1

Please # to comment.