diff options
author | Marijan Petricevic <marijan.petricevic94@gmail.com> | 2019-11-08 10:46:37 +0100 |
---|---|---|
committer | Marijan Petricevic <marijan.petricevic94@gmail.com> | 2019-11-08 11:20:54 +0100 |
commit | 5854aaf680e3c04629a62f36a2ea27dccd82fcae (patch) | |
tree | 6d8cd3cc0072d0eaba2a849f4126114d66f5a84a /nixos/lib/test-driver | |
parent | b937c4c734afffe5cf7bf83d1f85e861b7a8c68c (diff) |
nixos/tests: improve get_unit_info expressiveness on failure
Diffstat (limited to 'nixos/lib/test-driver')
-rw-r--r-- | nixos/lib/test-driver/test-driver.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index 93b8eebd2e12..978441dbce8f 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -319,7 +319,11 @@ class Machine: def get_unit_info(self, unit, user=None): status, lines = self.systemctl('--no-pager show "{}"'.format(unit), user) if status != 0: - return None + raise Exception( + 'retrieving systemctl info for unit "{}" {} failed with exit code {}'.format( + unit, "" if user is None else 'under user "{}"'.format(user), status + ) + ) line_pattern = re.compile(r"^([^=]+)=(.*)$") |