Check-in some TODOs and REFACTORs that have been around for a while
This commit is contained in:
parent
65d986c436
commit
35f2c6eaf5
3 changed files with 11 additions and 1 deletions
3
Gemfile
3
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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue