diff --git a/AUTHORS b/AUTHORS index e07b39f..772a3f8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,3 @@ Paco Gómez +Paco Gómez VMware GitHub Bot diff --git a/ChangeLog b/ChangeLog index 92e2e4e..7967304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ CHANGES ======= +0.0.5 +----- + +* changelog +* Improved exception handling (#1) +* Improved exception handling +* Update README.md 0.0.4 ----- diff --git a/vsphere_guest_run/vsphere.py b/vsphere_guest_run/vsphere.py index 7cff263..cce40c4 100644 --- a/vsphere_guest_run/vsphere.py +++ b/vsphere_guest_run/vsphere.py @@ -85,7 +85,8 @@ def execute_program_in_guest(self, try: processes = pm.ListProcessesInGuest(vm, creds, [pid]) if len(processes) == 0: - raise Exception('process not found (pid=%s)' % pid) + raise Exception('process not found (pid=%s) (vm=%s)' % + (pid, vm)) if processes[0].exitCode is not None: result = [processes[0].exitCode] if get_output: @@ -106,20 +107,23 @@ def execute_program_in_guest(self, else: print(str(e)) if callback is not None: - callback('process %s finished, exit code: %s' % - (result, processes[0].exitCode)) + callback( + 'process %s on vm %s finished, exit code: %s' % + (result, vm, processes[0].exitCode)) return result else: if callback is not None: n += 1 - callback('waiting for process %s to finish (%s)' % - (pid, n)) + callback( + 'waiting for process %s on vm %s to finish (%s)' % + (pid, vm, n)) time.sleep(wait_time) except Exception as e: if str(e).startswith('process not found ('): raise e if callback is not None: - callback('exception, will retry in a few seconds', e) + callback('exception, will retry in a few seconds, vm %s' % + vm, e) else: print(str(e)) print('will retry again in a few seconds')