From 2daabdf9fb20da5f17557673210bdeb8ba715306 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Mon, 4 Mar 2013 01:10:09 -0300 Subject: [PATCH] Yes we have provisioners! Closes #16 --- README.md | 1 - lib/vagrant-lxc/action.rb | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 045e19f..e03e223 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ sudo apt-get install lxc bsdtar * There is no support for setting a static IP. I'm using [LXC's built in dns server](lib/vagrant-lxc/container.rb#L100) to determine containers' IPs -* No provisioning [yet](https://github.com/fgrehm/vagrant-lxc/issues/16) * `sudo`s * only ubuntu cloudimg supported, I'm still [figuring out what should go on the .box](https://github.com/fgrehm/vagrant-lxc/issues/4) * "[works](https://github.com/fgrehm/vagrant-lxc/issues/20) on [my machine](https://github.com/fgrehm/vagrant-lxc/issues/7)" (TM) diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index e4dee2d..014ac1e 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -58,6 +58,30 @@ module Vagrant end end + # This action just runs the provisioners on the machine. + def self.action_provision + Vagrant::Action::Builder.new.tap do |b| + b.use CheckLXC + b.use Vagrant::Action::Builtin::ConfigValidate + b.use Vagrant::Action::Builtin::Call, Created do |env1, b2| + if !env1[:result] + b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated + next + end + + b2.use Vagrant::Action::Builtin::Call, IsRunning do |env2, b3| + if !env2[:result] + b3.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotRunning + next + end + + # b3.use CheckAccessible + b3.use Vagrant::Action::Builtin::Provision + end + end + end + end + # This action starts a container, assuming it is already created and exists. # A precondition of this action is that the container exists. def self.action_start