Bug #9519
closedteuthology-lock: if downburst list-json fails, error is confusing
0%
Description
I had updated teuthology but not updated-and-rebootstrapped downburst; as a result, downburst simply didn't have the list-json command that teuthology-lock wants to see for vps locking. The error, however, was not caught correctly, and reported with a Python traceback that looked a lot like "the os version isn't available", so I spent a while debugging it until I found that it was easier; the missing list-json meant there was no output, which was not trapped.
This code fixes it, in a kind of a cheap way; probably some other exception is more appropriate:
--- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -54,6 +54,9 @@ def get_distro_from_downburst(): p = subprocess.Popen([executable_cmd, 'list-json'], stdout=subprocess.PIPE, stderr=subprocess.PIPE,) output, err = p.communicate() + if p.returncode != 0: + log.info('downburst list-json failed') + raise OSError downburst_data = json.loads(output) return downburst_data
Updated by Anonymous over 9 years ago
- Status changed from New to 12
- Assignee set to Anonymous
Updated by Anonymous over 9 years ago
The code has been changed as suggested. I thought about testing err on the p.communicate() return, but that returns text. Scanning for Errors in that text seemed less clean than checking the communicate() return code. I also considered returning default_table, but scrapped that idea because I think that we still want to print the "Using default values..." log.info messaage
when this happens.
This change is ready for review as pull request #334.
Updated by Anonymous over 9 years ago
- Status changed from 12 to Fix Under Review
- Assignee changed from Anonymous to Dan Mick
Updated by Dan Mick over 9 years ago
- Assignee changed from Dan Mick to Anonymous
Updated by Anonymous over 9 years ago
- Status changed from 4 to Resolved
Commit a6ce70d05250f8927d050b513a2f58ccd76de878