21 lines
375 B
Ruby
Executable File
21 lines
375 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
require_relative "lib/lxc"
|
|
|
|
registry = Lxc::Registry.new
|
|
containers = `lxc-ls -1`.split(/\n/)
|
|
|
|
modified = false
|
|
network = registry.data["network"] || {}
|
|
network.each do |host, value|
|
|
unless containers.include?(host) or value["lxc"] == false
|
|
network.delete(host)
|
|
modified = true
|
|
end
|
|
end
|
|
|
|
if modified
|
|
registry.save
|
|
else
|
|
puts "Unchanged"
|
|
end
|