12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/osctld/commands/net_interface/delete.rb', line 12
def execute(ct)
ret = manipulate(ct) do
if ct.state != :stopped
next error('the container must be stopped to remove network interface')
end
netif = ct.netifs[opts[:name]]
next error('network interface not found') unless netif
ct.netifs.delete(netif)
ct.lxc_config.configure_network
DistConfig.run(ct.get_run_conf, :remove_netif, netif:)
ok
end
if ret[:status]
call_cmd(Commands::User::LxcUsernet)
ok
else
ret
end
end
|