Skip to content

Commit

Permalink
generate: Do not touch wait-online, if we don't have any networkd Net…
Browse files Browse the repository at this point in the history
…Defs
  • Loading branch information
slyon committed Apr 17, 2024
1 parent ef3a715 commit 7d0067d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ int main(int argc, char** argv)
if (netplan_state_get_backend(np_state) == NETPLAN_BACKEND_NM || any_nm)
_netplan_g_string_free_to_file(g_string_new(NULL), rootdir, "/run/NetworkManager/conf.d/10-globally-managed-devices.conf", NULL);

gboolean enable_wait_online = _netplan_networkd_write_wait_online(np_state, rootdir);
gboolean enable_wait_online = FALSE;
if (any_networkd)
enable_wait_online = _netplan_networkd_write_wait_online(np_state, rootdir);

if (called_as_generator) {
/* Ensure networkd starts if we have any configuration for it */
if (any_networkd)
Expand Down
4 changes: 4 additions & 0 deletions tests/generator/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def test_no_configs(self):
self.assert_nm(None)
self.assert_nm_udev(None)
self.assert_ovs({'cleanup.service': OVS_CLEANUP % {'iface': 'cleanup'}})
# should not touch -wait-online
service_dir = os.path.join(self.workdir.name, 'run', 'systemd', 'system')
override = os.path.join(service_dir, 'systemd-networkd-wait-online.service.d', '10-netplan.conf')
self.assertFalse(os.path.isfile(override))

def test_empty_config(self):
self.generate('')
Expand Down

0 comments on commit 7d0067d

Please sign in to comment.