lib/kontena/machine/vagrant/master_destroyer.rb in kontena-plugin-vagrant-0.2.7 vs lib/kontena/machine/vagrant/master_destroyer.rb in kontena-plugin-vagrant-0.3.0
- old
+ new
@@ -1,26 +1,19 @@
-require 'fileutils'
+require_relative 'common'
module Kontena
module Machine
module Vagrant
class MasterDestroyer
-
+ include Kontena::Machine::Vagrant::Common
include Kontena::Cli::ShellSpinner
def run!
vagrant_path = "#{Dir.home}/.kontena/vagrant_master"
Dir.chdir(vagrant_path) do
- spinner "Terminating Kontena Master from Vagrant " do
- Open3.popen2('vagrant destroy -f') do |stdin, output, wait|
- while o = output.gets
- puts o if ENV['DEBUG']
- end
- if wait.value == 0
- FileUtils.remove_entry_secure(vagrant_path)
- end
- end
- end
+ spinner "Triggering termination of Kontena Master from Vagrant"
+ run_command('vagrant destroy -f')
+ FileUtils.remove_entry_secure(vagrant_path)
end
end
end
end
end