test: print an error when networkctl returns an unexpected EC

If networkctl crashes, like recently with SIGABRT, it returns absolutely
no output, which may be confusing during debugging. Help it a little
with a short informative message.
This commit is contained in:
Frantisek Sumsal 2019-07-30 20:27:34 +02:00
parent 2de705cd1c
commit 345997f393
1 changed files with 3 additions and 1 deletions

View File

@ -420,7 +420,9 @@ DHCP={}
subprocess.call(['ip', 'a', 'show', 'dev', self.iface])
print('---- networkctl status {} ----'.format(self.iface))
sys.stdout.flush()
subprocess.call(['networkctl', 'status', self.iface])
rc = subprocess.call(['networkctl', 'status', self.iface])
if rc != 0:
print("'networkctl status' exited with an unexpected code {}".format(rc))
self.show_journal('systemd-networkd.service')
self.print_server_log()
raise