diff options
author | termie <github@anarkystic.com> | 2011-03-24 18:51:38 +0000 |
---|---|---|
committer | Tarmac <> | 2011-03-24 18:51:38 +0000 |
commit | 0d42b309ac723d18e6795210bc8d8ca6d295de23 (patch) | |
tree | 1b322d6768213a38fc234b37f5d949dbacca53bb /nova/utils.py | |
parent | f743e5374d58ab2c45702932da7b702ebb060817 (diff) | |
parent | 3c0fcc47be08ac4f3d508fd46f3b95036899aaad (diff) | |
download | nova-0d42b309ac723d18e6795210bc8d8ca6d295de23.tar.gz nova-0d42b309ac723d18e6795210bc8d8ca6d295de23.tar.xz nova-0d42b309ac723d18e6795210bc8d8ca6d295de23.zip |
Fixes a bug that was causing tests to fail on OS X by ensuring that greenthread sleep is called during retry loops.
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 e4d8a70eb..2f568f739 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -171,10 +171,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: @@ -183,6 +179,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, |