Skip to content

Commit

Permalink
[daemon] Run commands at boot only if needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
luis4a0 committed Nov 8, 2023
1 parent d81ebb4 commit a190934
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3228,14 +3228,21 @@ void mp::Daemon::configure_new_interfaces(const std::string& name, mp::VirtualMa

auto& commands = run_at_boot[name];

for (const auto i : new_interfaces)
try
{
vm.add_network_interface(i, specs.extra_interfaces[i]);
for (const auto i : new_interfaces)
{
vm.add_network_interface(i, specs.extra_interfaces[i]);

commands.push_back(generate_netplan_script(i, specs.extra_interfaces[i].mac_address));
}
commands.push_back(generate_netplan_script(i, specs.extra_interfaces[i].mac_address));
}

commands.push_back("sudo netplan apply");
commands.push_back("sudo netplan apply");
}
catch (const mp::NotImplementedOnThisBackendException&)
{
run_at_boot.erase(name);
}
}
}

Expand Down

0 comments on commit a190934

Please sign in to comment.