lxc-config/hooks/update-lxc-configs

21 lines
779 B
Plaintext
Raw Normal View History

2015-01-30 13:26:44 +00:00
#!/usr/bin/env ruby
require "pathname"
require_relative "lib/lxc"
registry = Lxc::Registry.new
2016-02-02 22:15:17 +00:00
container_root = Pathname.new(registry.data["zone"]["lxc-root"])
2015-01-30 13:26:44 +00:00
network = registry.data["network"] || {}
network.each do |name, container|
next if container["lxc"] == false
2015-09-16 21:34:04 +00:00
shared_rootfs = registry.data["zone"]["shared_rootfs"]
2015-01-30 13:26:44 +00:00
container = Lxc::Container.new(registry.data,
name: name,
ipv4: container["ipv4"],
ipv6: container["ipv6"],
2015-08-05 15:33:37 +00:00
ula: container["ula"],
2015-01-30 13:26:44 +00:00
group: container["group"],
vars: container["vars"])
2015-09-16 21:34:04 +00:00
container.write_config(container_root.join(name, "config"))
2015-01-30 13:26:44 +00:00
end