configureable subnet

This commit is contained in:
Jörg Thalheim 2015-01-17 20:18:15 +00:00
parent 51ae348edb
commit df90f83eb7

View File

@ -23,10 +23,6 @@ def find_address(subnet, assigned_subsubnets)
end end
end end
CONFIG_PATH = Pathname.new("/etc/lxc/")
IPV4_SUBNET = NetAddr::CIDR.create("192.168.66.0/24")
IPV6_SUBNET = NetAddr::CIDR.create("2a01:4f8:210:31fd:1::/80")
options = OpenStruct.new options = OpenStruct.new
options.container_name = try_env("LXC_NAME") options.container_name = try_env("LXC_NAME")
options.container_config = try_env("LXC_CONFIG_FILE") options.container_config = try_env("LXC_CONFIG_FILE")
@ -57,6 +53,7 @@ OptionParser.new do |opts|
end end
end end
end.parse! end.parse!
CONFIG_PATH = Pathname.new("/etc/lxc/")
container_data = CONFIG_PATH.join("container.json") container_data = CONFIG_PATH.join("container.json")
data = if File.exists?(container_data) data = if File.exists?(container_data)
@ -65,6 +62,10 @@ data = if File.exists?(container_data)
{} {}
end end
zone = data["zone"] || {}
IPV4_SUBNET = NetAddr::CIDR.create(zone["v4_subnet"] || "192.168.10.0/24")
IPV6_SUBNET = NetAddr::CIDR.create(zone["v6_subnet"] || "fd7d:aed0:18aa::/48")
data["network"] ||= {} data["network"] ||= {}
#if data["network"][options.container_name] #if data["network"][options.container_name]