2013-03-05 03:58:37 +00:00
|
|
|
module Vagrant
|
|
|
|
module LXC
|
|
|
|
module Action
|
2013-04-02 00:05:19 +00:00
|
|
|
class Network
|
|
|
|
def initialize(app, env)
|
|
|
|
@app = app
|
|
|
|
end
|
|
|
|
|
2013-03-05 03:58:37 +00:00
|
|
|
def call(env)
|
|
|
|
@env = env
|
|
|
|
|
|
|
|
env[:machine].config.vm.networks.each do |type, options|
|
|
|
|
# We only handle private networks
|
|
|
|
next if type != :private_network
|
|
|
|
env[:machine].provider_config.start_opts << "lxc.network.ipv4=#{options[:ip]}/24"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Continue the middleware chain.
|
|
|
|
@app.call(env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|