diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index 103bd97..e574447 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -1,6 +1,5 @@ require 'vagrant-lxc/action/base_action' -require 'vagrant-lxc/action/after_create' require 'vagrant-lxc/action/boot' require 'vagrant-lxc/action/check_created' require 'vagrant-lxc/action/check_running' @@ -54,7 +53,6 @@ module Vagrant b.use ForwardPorts b.use SaneDefaults b.use Customize - b.use AfterCreate b.use Boot end end diff --git a/lib/vagrant-lxc/action/after_create.rb b/lib/vagrant-lxc/action/after_create.rb deleted file mode 100644 index 1e12ebc..0000000 --- a/lib/vagrant-lxc/action/after_create.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Vagrant - module LXC - module Action - class AfterCreate < BaseAction - def call(env) - # Continue, we need the VM to be booted. - @app.call env - if env[:just_created] && (script = env[:machine].box.metadata['after-create-script']) - env[:machine].provider.container.run_after_create_script script - end - end - end - end - end -end diff --git a/lib/vagrant-lxc/container.rb b/lib/vagrant-lxc/container.rb index f1666c4..7945d13 100644 --- a/lib/vagrant-lxc/container.rb +++ b/lib/vagrant-lxc/container.rb @@ -55,21 +55,6 @@ module Vagrant @name end - def run_after_create_script(script) - private_key = Vagrant.source_root.join('keys', 'vagrant').expand_path.to_s - - # TODO: Gotta write somewhere that it has to be indempotent - retryable(:tries => 5, :sleep => 2) do - @logger.debug 'Attempt to run after-create-script from box metadata' - execute *[ - script, - '-r', rootfs_path.to_s, - '-k', private_key, - '-i', dhcp_ip - ] - end - end - def rootfs_path Pathname.new("#{CONTAINERS_PATH}/#{@name}/rootfs") end diff --git a/spec/unit/container_spec.rb b/spec/unit/container_spec.rb index 4d61e4b..bf0ab56 100644 --- a/spec/unit/container_spec.rb +++ b/spec/unit/container_spec.rb @@ -100,27 +100,6 @@ describe Vagrant::LXC::Container do end end - describe 'after create script execution' do - let(:name) { 'random-container-name' } - let(:after_create_path) { '/path/to/after/create' } - let(:execute_cmd) { @execute_cmd } - let(:priv_key_path) { Vagrant.source_root.join('keys', 'vagrant').expand_path.to_s } - let(:ip) { '10.0.3.234' } - - before do - subject.stub(dhcp_ip: ip) - subject.stub(:execute) { |*args| @execute_cmd = args.join(' ') } - subject.run_after_create_script after_create_path - end - - it 'runs after-create-script when present passing required variables' do - execute_cmd.should include after_create_path - execute_cmd.should include "-r /var/lib/lxc/#{name}/rootfs" - execute_cmd.should include "-k #{priv_key_path}" - execute_cmd.should include "-i #{ip}" - end - end - describe 'destruction' do let(:name) { 'container-name' }