lxc-config/hooks/update-lxc-configs
2016-02-02 22:15:17 +00:00

21 lines
779 B
Ruby
Executable File

#!/usr/bin/env ruby
require "pathname"
require_relative "lib/lxc"
registry = Lxc::Registry.new
container_root = Pathname.new(registry.data["zone"]["lxc-root"])
network = registry.data["network"] || {}
network.each do |name, container|
next if container["lxc"] == false
shared_rootfs = registry.data["zone"]["shared_rootfs"]
container = Lxc::Container.new(registry.data,
name: name,
ipv4: container["ipv4"],
ipv6: container["ipv6"],
ula: container["ula"],
group: container["group"],
vars: container["vars"])
container.write_config(container_root.join(name, "config"))
end