Skip to content

Commit

Permalink
CA-382842: Fix issue of "Connection refused"
Browse files Browse the repository at this point in the history
- If VM network has not yet started completely, ssh to it may encounter
  failure. Here the fix is raising the exception to let ssh command
  caller do retry.

Signed-off-by: Deli Zhang <deli.zhang@citrix.com>
  • Loading branch information
DeliZhangX committed Sep 21, 2023
1 parent 1bc5e48 commit 021f6f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autocertkit/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def run_cmd_ext(self, cmd):

with open(f'/tmp/{fcmd}', 'w') as f:
f.write(cmd)
self.put_file(f'/tmp/{fcmd}')
res = self.put_file(f'/tmp/{fcmd}')
if res['returncode']:
os.remove(f'/tmp/{fcmd}')
raise Exception(f'{SCP} failed, maybe {self.ip} is not yet ready.')

self.run_cmd(fr'sh {fcmd} >{fout} 2>{ferr}; echo "$?" >{frc}')

Expand Down

0 comments on commit 021f6f4

Please sign in to comment.