Skip to content

Commit 6ac784b

Browse files
committed
improve error message
1 parent e09f365 commit 6ac784b

File tree

1 file changed

+6
-7
lines changed
  • dbaas/workflow/steps/util

1 file changed

+6
-7
lines changed

dbaas/workflow/steps/util/vm.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,13 @@ def check_access(origin, destiny, port):
220220
script = "(echo >/dev/tcp/{}/{}) &>/dev/null && exit 0 || exit 1"
221221
script = script.format(destiny.address, port)
222222
try:
223-
output = origin.ssh.run_script(script)
224-
except origin.ssh.ScriptFailedException:
225-
err = 'Could not connect from {} to {}:{}'.format(
226-
origin.address, destiny.address, port
223+
origin.ssh.run_script(script)
224+
except origin.ssh.ScriptFailedException as err:
225+
raise EnvironmentError(
226+
'Could not connect from {} to {}:{} - Error: {}'.format(
227+
origin.address, destiny.address, port, err
228+
)
227229
)
228-
if output:
229-
err += ' - Error: {}'.format(output)
230-
raise EnvironmentError(err)
231230

232231
def do(self):
233232
self.check_access(self.host, self.master, self.driver.default_port)

0 commit comments

Comments
 (0)