diff --git a/Gemfile b/Gemfile index 21fb792..3b6d969 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,10 @@ source 'https://rubygems.org' gemspec +# TODO: Group gems + gem 'rake' +# TODO: setup rake-notes gem 'net-ssh' gem 'rspec' gem 'rspec-fire', require: 'rspec/fire' diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index 014ac1e..09b4a9b 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -122,9 +122,11 @@ module Vagrant b.use CheckLXC b.use Vagrant::Action::Builtin::Call, Created do |env, b2| if env[:result] - # TODO: If could not gracefully halt, force it b2.use Vagrant::Action::Builtin::Call, Vagrant::Action::Builtin::GracefulHalt, :stopped, :running do |env2, b3| if !env2[:result] && env2[:machine].provider.state.running? + # TODO: Container#halt is kinda graceful as well, if it doesn't + # or we can issue a lxc-stop. Might as well be handled by the + # container itself, who knows, we just need to handle it :P env2[:machine].provider.container.halt end end diff --git a/lib/vagrant-lxc/container.rb b/lib/vagrant-lxc/container.rb index 7be5ed8..9ebff52 100644 --- a/lib/vagrant-lxc/container.rb +++ b/lib/vagrant-lxc/container.rb @@ -9,6 +9,7 @@ require "vagrant-lxc/errors" module Vagrant module LXC + # REFACTOR: Encapsulate lxc commands with name class Container # Include this so we can use `Subprocess` more easily. include Vagrant::Util::Retryable @@ -96,12 +97,16 @@ module Vagrant def halt lxc :shutdown, '--name', @name wait_until :stopped + # TODO: issue an lxc-stop if a timeout gets reached end def destroy lxc :destroy, '--name', @name end + # REFACTOR: + # transition_to :state do + # ... code ... def wait_until(state) lxc :wait, '--name', @name, '--state', state.to_s.upcase end