diff options
| author | Zhengguang <zhengguangou@gmail.com> | 2014-07-10 23:01:10 -0400 |
|---|---|---|
| committer | Zhengguang <zhengguangou@gmail.com> | 2014-07-28 09:08:36 -0400 |
| commit | bf8fa0b606ca3c25808f526de0c06d1374dc7411 (patch) | |
| tree | c880b0f5215d7e501987ba3559a4037930c27048 /cinderclient/v1/shell.py | |
| parent | 14a5aa045a391a900e34a5341b07b71ac973cf77 (diff) | |
| download | python-cinderclient-bf8fa0b606ca3c25808f526de0c06d1374dc7411.tar.gz | |
Fix the return code of the command reset-state
Currently, the command reset-state return code is zero if it
failed for any of volumes, it should be nonzero.
Change-Id: Ic6da238861fd003375003399bc6def6bf860a015
Closes-Bug: #1339643
Diffstat (limited to 'cinderclient/v1/shell.py')
| -rw-r--r-- | cinderclient/v1/shell.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 47e0a57..bb58a27 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -332,22 +332,18 @@ def do_force_delete(cs, args): @utils.service_type('volume') def do_reset_state(cs, args): """Explicitly updates the volume state.""" - failure_count = 0 - - single = (len(args.volume) == 1) + failure_flag = False for volume in args.volume: try: utils.find_volume(cs, volume).reset_state(args.state) except Exception as e: - failure_count += 1 + failure_flag = True msg = "Reset state for volume %s failed: %s" % (volume, e) - if not single: - print(msg) + print(msg) - if failure_count == len(args.volume): - if not single: - msg = "Unable to reset the state for any of the specified volumes." + if failure_flag: + msg = "Unable to reset the state for the specified volume(s)." raise exceptions.CommandError(msg) |
