diff options
author | termie <github@anarkystic.com> | 2011-03-23 13:39:01 -0700 |
---|---|---|
committer | termie <github@anarkystic.com> | 2011-03-23 13:39:01 -0700 |
commit | 3c0fcc47be08ac4f3d508fd46f3b95036899aaad (patch) | |
tree | c6bc9be871d48403bad51320dd6a5acd529ccb2d /nova/utils.py | |
parent | 6afe9f0576532b90ef2d5891f06b8bd04401db5b (diff) | |
download | nova-3c0fcc47be08ac4f3d508fd46f3b95036899aaad.tar.gz nova-3c0fcc47be08ac4f3d508fd46f3b95036899aaad.tar.xz nova-3c0fcc47be08ac4f3d508fd46f3b95036899aaad.zip |
fix utils.execute retries for osx
also some minor misc cleanups
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nova/utils.py b/nova/utils.py index 499af2039..249470636 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -170,10 +170,6 @@ def execute(*cmd, **kwargs): stdout=stdout, stderr=stderr, cmd=' '.join(cmd)) - # NOTE(termie): this appears to be necessary to let the subprocess - # call clean something up in between calls, without - # it two execute calls in a row hangs the second one - greenthread.sleep(0) return result except ProcessExecutionError: if not attempts: @@ -182,6 +178,11 @@ def execute(*cmd, **kwargs): LOG.debug(_("%r failed. Retrying."), cmd) if delay_on_retry: greenthread.sleep(random.randint(20, 200) / 100.0) + finally: + # NOTE(termie): this appears to be necessary to let the subprocess + # call clean something up in between calls, without + # it two execute calls in a row hangs the second one + greenthread.sleep(0) def ssh_execute(ssh, cmd, process_input=None, |