parent
dee099ce96
commit
97f6edeed8
6 changed files with 15 additions and 19 deletions
|
@ -15,7 +15,7 @@ FEATURES:
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
- Error out if `redir` is not installed but port forwarding was configured [#112](https://github.com/fgrehm/vagrant-lxc/issues/112)
|
- Error out if dependencies are not installed [#11](https://github.com/fgrehm/vagrant-lxc/issues/11) / [#112](https://github.com/fgrehm/vagrant-lxc/issues/112)
|
||||||
- Support for specifying host interface/ip for binding `redir` [#76](https://github.com/fgrehm/vagrant-lxc/issues/76)
|
- Support for specifying host interface/ip for binding `redir` [#76](https://github.com/fgrehm/vagrant-lxc/issues/76)
|
||||||
- Add Vagrantfile VM name to the container name [#115](https://github.com/fgrehm/vagrant-lxc/issues/115)
|
- Add Vagrantfile VM name to the container name [#115](https://github.com/fgrehm/vagrant-lxc/issues/115)
|
||||||
- Properly handle forwarded port collisions [#5](https://github.com/fgrehm/vagrant-lxc/issues/5)
|
- Properly handle forwarded port collisions [#5](https://github.com/fgrehm/vagrant-lxc/issues/5)
|
||||||
|
|
|
@ -139,14 +139,6 @@ for a list of [pre built](https://github.com/fgrehm/vagrant-lxc/wiki/Base-boxes#
|
||||||
base boxes and information on [how to build your own](https://github.com/fgrehm/vagrant-lxc/wiki/Base-boxes#building-your-own).
|
base boxes and information on [how to build your own](https://github.com/fgrehm/vagrant-lxc/wiki/Base-boxes#building-your-own).
|
||||||
|
|
||||||
|
|
||||||
## Current limitations
|
|
||||||
|
|
||||||
* [Does not tell you if dependencies are not met](https://github.com/fgrehm/vagrant-lxc/issues/11)
|
|
||||||
(will probably just throw up some random error)
|
|
||||||
* + bunch of other [core features](https://github.com/fgrehm/vagrant-lxc/issues?labels=core&milestone=&page=1&state=open)
|
|
||||||
and some known [bugs](https://github.com/fgrehm/vagrant-lxc/issues?labels=bug&page=1&state=open)
|
|
||||||
|
|
||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
Please refer the [wiki](https://github.com/fgrehm/vagrant-lxc/wiki) for more
|
Please refer the [wiki](https://github.com/fgrehm/vagrant-lxc/wiki) for more
|
||||||
|
|
|
@ -25,7 +25,6 @@ module Vagrant
|
||||||
# machine back up with the new configuration.
|
# machine back up with the new configuration.
|
||||||
def self.action_reload
|
def self.action_reload
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
||||||
if !env1[:result]
|
if !env1[:result]
|
||||||
b2.use Message, :not_created
|
b2.use Message, :not_created
|
||||||
|
@ -44,7 +43,6 @@ module Vagrant
|
||||||
# a bootup (i.e. not saved).
|
# a bootup (i.e. not saved).
|
||||||
def self.action_boot
|
def self.action_boot
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use ClearForwardedPorts
|
|
||||||
b.use Vagrant::Action::Builtin::Provision
|
b.use Vagrant::Action::Builtin::Provision
|
||||||
b.use Vagrant::Action::Builtin::EnvSet, :port_collision_repair => true
|
b.use Vagrant::Action::Builtin::EnvSet, :port_collision_repair => true
|
||||||
b.use Vagrant::Action::Builtin::HandleForwardedPortCollisions
|
b.use Vagrant::Action::Builtin::HandleForwardedPortCollisions
|
||||||
|
@ -58,7 +56,6 @@ module Vagrant
|
||||||
# This action just runs the provisioners on the machine.
|
# This action just runs the provisioners on the machine.
|
||||||
def self.action_provision
|
def self.action_provision
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::ConfigValidate
|
b.use Vagrant::Action::Builtin::ConfigValidate
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
||||||
if !env1[:result]
|
if !env1[:result]
|
||||||
|
@ -82,7 +79,6 @@ module Vagrant
|
||||||
# A precondition of this action is that the container exists.
|
# A precondition of this action is that the container exists.
|
||||||
def self.action_start
|
def self.action_start
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::ConfigValidate
|
b.use Vagrant::Action::Builtin::ConfigValidate
|
||||||
b.use Vagrant::Action::Builtin::Call, IsRunning do |env, b2|
|
b.use Vagrant::Action::Builtin::Call, IsRunning do |env, b2|
|
||||||
# If the VM is running, then our work here is done, exit
|
# If the VM is running, then our work here is done, exit
|
||||||
|
@ -97,7 +93,6 @@ module Vagrant
|
||||||
# container, configuring metadata, and booting.
|
# container, configuring metadata, and booting.
|
||||||
def self.action_up
|
def self.action_up
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::ConfigValidate
|
b.use Vagrant::Action::Builtin::ConfigValidate
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
||||||
# If the VM is NOT created yet, then do the setup steps
|
# If the VM is NOT created yet, then do the setup steps
|
||||||
|
@ -115,7 +110,6 @@ module Vagrant
|
||||||
# the virtual machine, gracefully or by force.
|
# the virtual machine, gracefully or by force.
|
||||||
def self.action_halt
|
def self.action_halt
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
||||||
if env[:result]
|
if env[:result]
|
||||||
# TODO: Remove this on / after 0.4
|
# TODO: Remove this on / after 0.4
|
||||||
|
@ -138,7 +132,6 @@ module Vagrant
|
||||||
# freeing the resources of the underlying virtual machine.
|
# freeing the resources of the underlying virtual machine.
|
||||||
def self.action_destroy
|
def self.action_destroy
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
||||||
if !env1[:result]
|
if !env1[:result]
|
||||||
b2.use Message, :not_created
|
b2.use Message, :not_created
|
||||||
|
@ -162,7 +155,6 @@ module Vagrant
|
||||||
# This action packages the virtual machine into a single box file.
|
# This action packages the virtual machine into a single box file.
|
||||||
def self.action_package
|
def self.action_package
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
|
||||||
if !env1[:result]
|
if !env1[:result]
|
||||||
b2.use Message, :not_created
|
b2.use Message, :not_created
|
||||||
|
@ -180,7 +172,6 @@ module Vagrant
|
||||||
# This is the action that will exec into an SSH shell.
|
# This is the action that will exec into an SSH shell.
|
||||||
def self.action_ssh
|
def self.action_ssh
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use CheckCreated
|
b.use CheckCreated
|
||||||
b.use CheckRunning
|
b.use CheckRunning
|
||||||
b.use Vagrant::Action::Builtin::SSHExec
|
b.use Vagrant::Action::Builtin::SSHExec
|
||||||
|
@ -190,7 +181,6 @@ module Vagrant
|
||||||
# This is the action that will run a single SSH command.
|
# This is the action that will run a single SSH command.
|
||||||
def self.action_ssh_run
|
def self.action_ssh_run
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
# b.use CheckDependencies
|
|
||||||
b.use CheckCreated
|
b.use CheckCreated
|
||||||
b.use CheckRunning
|
b.use CheckRunning
|
||||||
b.use Vagrant::Action::Builtin::SSHRun
|
b.use Vagrant::Action::Builtin::SSHRun
|
||||||
|
|
|
@ -7,6 +7,10 @@ module Vagrant
|
||||||
error_key(:lxc_execute_error)
|
error_key(:lxc_execute_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class LxcNotInstalled < Vagrant::Errors::VagrantError
|
||||||
|
error_key(:lxc_not_installed)
|
||||||
|
end
|
||||||
|
|
||||||
# Box related errors
|
# Box related errors
|
||||||
class TemplateFileMissing < Vagrant::Errors::VagrantError
|
class TemplateFileMissing < Vagrant::Errors::VagrantError
|
||||||
error_key(:lxc_template_file_missing)
|
error_key(:lxc_template_file_missing)
|
||||||
|
|
|
@ -14,6 +14,7 @@ module Vagrant
|
||||||
@logger = Log4r::Logger.new("vagrant::provider::lxc")
|
@logger = Log4r::Logger.new("vagrant::provider::lxc")
|
||||||
@machine = machine
|
@machine = machine
|
||||||
|
|
||||||
|
ensure_lxc_installed!
|
||||||
machine_id_changed
|
machine_id_changed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,6 +26,12 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ensure_lxc_installed!
|
||||||
|
unless system("which lxc-version > /dev/null")
|
||||||
|
raise Errors::LxcNotInstalled
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# If the machine ID changed, then we need to rebuild our underlying
|
# If the machine ID changed, then we need to rebuild our underlying
|
||||||
# container.
|
# container.
|
||||||
def machine_id_changed
|
def machine_id_changed
|
||||||
|
|
|
@ -45,5 +45,8 @@ en:
|
||||||
The template file used for creating the container was not found for %{name}
|
The template file used for creating the container was not found for %{name}
|
||||||
box.
|
box.
|
||||||
|
|
||||||
|
lxc_not_installed: |-
|
||||||
|
The `lxc` package does not seem to be installed or is not accessible on the PATH.
|
||||||
|
|
||||||
lxc_redir_not_installed: |-
|
lxc_redir_not_installed: |-
|
||||||
`redir` is not installed or is not accessible on the PATH.
|
`redir` is not installed or is not accessible on the PATH.
|
||||||
|
|
Loading…
Reference in a new issue