2013-11-06 22:40:05 +00:00
|
|
|
module Vagrant
|
|
|
|
module LXC
|
|
|
|
module Action
|
|
|
|
class WarnNetworks
|
|
|
|
def initialize(app, env)
|
|
|
|
@app = app
|
|
|
|
end
|
|
|
|
|
|
|
|
def call(env)
|
2013-11-06 23:21:16 +00:00
|
|
|
if public_or_private_network_configured?(env[:machine].config)
|
2013-11-06 22:40:05 +00:00
|
|
|
env[:ui].warn(I18n.t("vagrant_lxc.messages.warn_networks"))
|
|
|
|
end
|
|
|
|
|
|
|
|
@app.call(env)
|
|
|
|
end
|
|
|
|
|
2013-11-06 23:21:16 +00:00
|
|
|
def public_or_private_network_configured?(config)
|
|
|
|
config.vm.networks.find do |type, _|
|
2013-11-06 22:40:05 +00:00
|
|
|
[:private_network, :public_network].include?(type.to_sym)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|