diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e73b37..8e48fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index d921829..04adeff 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -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 diff --git a/lib/vagrant-lxc/driver/cli.rb b/lib/vagrant-lxc/driver/cli.rb index a2aba8a..d7ada25 100644 --- a/lib/vagrant-lxc/driver/cli.rb +++ b/lib/vagrant-lxc/driver/cli.rb @@ -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