From aac8c31410feca90138e1bace9db354946b90f31 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 24 Jul 2014 21:53:35 -0300 Subject: [PATCH] driver: Remove calls to in favor of Vagrant's built in graceful halt --- CHANGELOG.md | 1 + lib/vagrant-lxc/driver.rb | 4 ---- lib/vagrant-lxc/driver/cli.rb | 10 ---------- 3 files changed, 1 insertion(+), 14 deletions(-) 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