Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/tests: improve get_unit_info expressiveness on failure #73032

Merged
merged 1 commit into from Nov 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion nixos/lib/test-driver/test-driver.py
Expand Up @@ -319,7 +319,11 @@ def wait_for_unit(self, unit, user=None):
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(
Copy link
Member

@Mic92 Mic92 Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. The current usage of this function in the code of this is buggy in the presents of returning None.

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

Expand Down