driver: Remove calls to in favor of Vagrant's built in graceful halt

This commit is contained in:
Fabio Rehm 2014-07-24 21:53:35 -03:00
parent d0642c95fd
commit aac8c31410
3 changed files with 1 additions and 14 deletions

View file

@ -2,6 +2,7 @@
IMPROVEMENTS:
- Remove `lxc-shutdown` usage in favor of Vagrant's built in graceful halt
- Add fallback mechanism for platforms without `lxc-attach` support [[GH-294]]
[GH-294]: https://github.com/fgrehm/vagrant-lxc/pull/294

View file

@ -104,10 +104,6 @@ module Vagrant
def forced_halt
@logger.info('Shutting down container...')
# TODO: Remove `lxc-shutdown` usage, graceful halt is enough
@cli.transition_to(:stopped) { |c| c.shutdown }
# REFACTOR: Do not use exception to control the flow
rescue CLI::TargetStateNotReached, CLI::ShutdownNotSupported
@cli.transition_to(:stopped) { |c| c.stop }
end

View file

@ -10,7 +10,6 @@ module Vagrant
attr_accessor :name
class TransitionBlockNotProvided < RuntimeError; end
class ShutdownNotSupported < RuntimeError; end
class TargetStateNotReached < RuntimeError
def initialize(target_state, state)
msg = "Target state '#{target_state}' not reached, currently on '#{state}'"
@ -81,15 +80,6 @@ module Vagrant
run :stop, '--name', @name
end
def shutdown
if system('which lxc-shutdown > /dev/null')
run :shutdown, '--name', @name
else
# REFACTOR: Do not use exception to control the flow
raise ShutdownNotSupported
end
end
def attach(*cmd)
cmd = ['--'] + cmd