Merge pull request #73032 from marijanp/improvement-test-driver-py

nixos/tests: improve get_unit_info expressiveness on failure
This commit is contained in:
Jörg Thalheim 2019-11-08 10:26:20 +00:00 committed by GitHub
commit 438a0cd40b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"^([^=]+)=(.*)$")