vagrant-lxc-ng/lib/vagrant-lxc/action/warn_networks.rb

26 lines
587 B
Ruby
Raw Normal View History

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)
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, _|
[:private_network, :public_network].include?(type.to_sym)
end
end
end
end
end
end