Better than a note on the readme is a warning for users about unsupported private / public networks :)

Closes GH-154
This commit is contained in:
Fabio Rehm 2013-11-06 20:40:05 -02:00
parent c61ade8ef4
commit 6b5db24a6b
4 changed files with 35 additions and 0 deletions

View file

@ -1,5 +1,9 @@
## [0.6.5](https://github.com/fgrehm/vagrant-lxc/compare/v0.6.4...master) (unreleased)
IMPROVEMENTS:
- Warn users about unsupported private / public networking configs [#154](https://github.com/fgrehm/vagrant-lxc/issues/154)
BUG FIXES:
- Error out in case an invalid IPs are provided for forwarded ports [#170](https://github.com/fgrehm/vagrant-lxc/issues/170)

View file

@ -18,6 +18,7 @@ require 'vagrant-lxc/action/message'
require 'vagrant-lxc/action/remove_temporary_files'
require 'vagrant-lxc/action/setup_package_files'
require 'vagrant-lxc/action/share_folders'
require 'vagrant-lxc/action/warn_networks'
unless Vagrant::LXC.vagrant_1_3_or_later
require 'vagrant-lxc/action/wait_for_communicator'
@ -58,6 +59,7 @@ module Vagrant
b.use Builtin::HandleForwardedPortCollisions
b.use ShareFolders
b.use Builtin::SetHostname
b.use WarnNetworks
b.use ForwardPorts
b.use Boot
b.use Builtin::WaitForCommunicator

View file

@ -0,0 +1,25 @@
module Vagrant
module LXC
module Action
class WarnNetworks
def initialize(app, env)
@app = app
end
def call(env)
if public_or_private_network_configured?
env[:ui].warn(I18n.t("vagrant_lxc.messages.warn_networks"))
end
@app.call(env)
end
def public_or_private_network_configured?
config.vm.networks.find do |type|
[:private_network, :public_network].include?(type.to_sym)
end
end
end
end
end
end

View file

@ -17,6 +17,10 @@ en:
Waiting for container to start. This should not take long.
container_ready: |-
Container started and ready for use!
warn_networks: |-
Warning! The LXC provider doesn't support any of the Vagrant public / private
network configurations (`config.vm.network :private_network, ip: "some-ip"`).
They will be silently ignored.
vagrant:
commands: