# create static systemd-network user for networkd-test-router.service (it
# needs to do some stuff as root and can't start as user; but networkd
# still insists on the user)
- subprocess.call(['adduser', '--system', '--no-create-home', 'systemd-network'])
+ if subprocess.call(['getent', 'passwd', 'systemd-network']) != 0:
+ subprocess.call(['useradd', '--system', '--no-create-home', 'systemd-network'])
for d in ['/etc/systemd/network', '/run/systemd/network',
'/run/systemd/netif', '/run/systemd/resolve']:
klass.orig_log_level = subprocess.check_output(
['systemctl', 'show', '--value', '--property', 'LogLevel'],
universal_newlines=True).strip()
- subprocess.check_call(['systemd-analyze', 'set-log-level', 'debug'])
+ subprocess.check_call(['systemd-analyze', 'log-level', 'debug'])
@classmethod
def tearDownClass(klass):
- subprocess.check_call(['systemd-analyze', 'set-log-level', klass.orig_log_level])
+ subprocess.check_call(['systemd-analyze', 'log-level', klass.orig_log_level])
def setUp(self):
self.iface = 'test_eth42'
# IPv6, but we want to wait for both
for _ in range(10):
out = subprocess.check_output(['ip', 'a', 'show', 'dev', self.iface])
- if b'state UP' in out and b'inet6 2600' in out and b'inet 192.168' in out:
+ if b'state UP' in out and b'inet6 2600' in out and b'inet 192.168' in out and b'tentative' not in out:
break
time.sleep(1)
else:
self.assertRegex(out, (r'{}\s+ether\s+[a-z-]+\s+unmanaged'.format(self.if_router)).encode())
self.assertRegex(out, (r'{}\s+ether\s+routable\s+configured'.format(self.iface)).encode())
- out = subprocess.check_output(['networkctl', 'status', self.iface])
+ out = subprocess.check_output(['networkctl', '-n', '0', 'status', self.iface])
self.assertRegex(out, br'Type:\s+ether')
self.assertRegex(out, br'State:\s+routable.*configured')
self.assertRegex(out, br'Address:\s+192.168.5.\d+')
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', '-n', '0', '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