mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
test-network: also save the current state of socket units for resolved and stop them
Silence the following waring:
```
Stopping 'systemd-resolved.service', but its triggering units are still active:
systemd-resolved-varlink.socket, systemd-resolved-monitor.socket
```
Follow-up for 0fa188307b.
This commit is contained in:
@@ -427,6 +427,8 @@ def save_active_units():
|
||||
'systemd-networkd.socket',
|
||||
'systemd-networkd-varlink.socket',
|
||||
'systemd-networkd.service',
|
||||
'systemd-resolved-monitor.socket',
|
||||
'systemd-resolved-varlink.socket',
|
||||
'systemd-resolved.service',
|
||||
'systemd-timesyncd.service',
|
||||
'firewalld.service'
|
||||
@@ -436,19 +438,31 @@ def save_active_units():
|
||||
active_units.append(u)
|
||||
|
||||
def restore_active_units():
|
||||
has_socket = False
|
||||
has_network_socket = False
|
||||
has_resolve_socket = False
|
||||
|
||||
if 'systemd-networkd.socket' in active_units:
|
||||
call('systemctl stop systemd-networkd.socket')
|
||||
has_socket = True
|
||||
has_network_socket = True
|
||||
|
||||
if 'systemd-networkd-varlink.socket' in active_units:
|
||||
call('systemctl stop systemd-networkd-varlink.socket')
|
||||
has_socket = True
|
||||
has_network_socket = True
|
||||
|
||||
if has_socket:
|
||||
if 'systemd-resolved-monitor.socket' in active_units:
|
||||
call('systemctl stop systemd-resolved-monitor.socket')
|
||||
has_resolve_socket = True
|
||||
|
||||
if 'systemd-resolved-varlink.socket' in active_units:
|
||||
call('systemctl stop systemd-resolved-varlink.socket')
|
||||
has_resolve_socket = True
|
||||
|
||||
if has_network_socket:
|
||||
call('systemctl stop systemd-networkd.service')
|
||||
|
||||
if has_resolve_socket:
|
||||
call('systemctl stop systemd-resolved.service')
|
||||
|
||||
for u in active_units:
|
||||
call(f'systemctl restart {u}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user