Sha256: 2c55d912a0e916de28cda9bedad0724c8ea54cb4cc10692c4b5b050e65c62ea7
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
module Kontena module Machine module Vagrant class NodeDestroyer include RandomName attr_reader :client, :api_client # @param [Kontena::Client] api_client Kontena api client def initialize(api_client) @api_client = api_client end def run!(grid, name) vagrant_path = "#{Dir.home}/.kontena/#{grid}/#{name}" Dir.chdir(vagrant_path) do ShellSpinner "Terminating Vagrant machine #{name.colorize(:cyan)} " do Open3.popen2('vagrant destroy -f') do |stdin, output, wait| while o = output.gets puts o if ENV['DEBUG'] end end end end node = api_client.get("grids/#{grid}/nodes")['nodes'].find{|n| n['name'] == name} if node ShellSpinner "Removing node #{name.colorize(:cyan)} from grid #{grid.colorize(:cyan)} " do api_client.delete("grids/#{grid}/nodes/#{name}") end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems