diff options
| author | Naveed Massjouni <naveedm9@gmail.com> | 2011-08-08 20:25:31 -0400 |
|---|---|---|
| committer | Naveed Massjouni <naveedm9@gmail.com> | 2011-08-08 20:25:31 -0400 |
| commit | 72dc7939f4bfd05588b09046cbd25be09413c4eb (patch) | |
| tree | 92d23ee75262e44ec5c149db5705442f6607cc9b /nova/utils.py | |
| parent | 543a783cefc3b34fa4a5d4ae5b9034090666d182 (diff) | |
| parent | d63bfef32d33edca440038c978f61bd303db23aa (diff) | |
| download | nova-72dc7939f4bfd05588b09046cbd25be09413c4eb.tar.gz nova-72dc7939f4bfd05588b09046cbd25be09413c4eb.tar.xz nova-72dc7939f4bfd05588b09046cbd25be09413c4eb.zip | |
Merge from trunk.
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/nova/utils.py b/nova/utils.py index da8826f1f..372358b42 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -126,6 +126,22 @@ def fetchfile(url, target): def execute(*cmd, **kwargs): + """ + Helper method to execute command with optional retry. + + :cmd Passed to subprocess.Popen. + :process_input Send to opened process. + :addl_env Added to the processes env. + :check_exit_code Defaults to 0. Raise exception.ProcessExecutionError + unless program exits with this code. + :delay_on_retry True | False. Defaults to True. If set to True, wait a + short amount of time before retrying. + :attempts How many times to retry cmd. + + :raises exception.Error on receiving unknown arguments + :raises exception.ProcessExecutionError + """ + process_input = kwargs.pop('process_input', None) addl_env = kwargs.pop('addl_env', None) check_exit_code = kwargs.pop('check_exit_code', 0) @@ -790,7 +806,7 @@ def parse_server_string(server_str): (address, port) = server_str.split(':') return (address, port) - except: + except Exception: LOG.debug(_('Invalid server_string: %s' % server_str)) return ('', '') |
