Sha256: 9b2dcfd543e96be43e67d745acbc1bab46339e6d4a47c695b2e2f4e3a2264bed

Contents?: true

Size: 778 Bytes

Versions: 18

Compression:

Stored size: 778 Bytes

Contents

module Kontena::Cli::Nodes::Vagrant
  class StopCommand < Clamp::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    parameter "NAME", "Node name"

    def execute
      require_api_url
      require_current_grid

      require 'kontena/machine/vagrant'
      vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
      abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
      Dir.chdir(vagrant_path) do
          ShellSpinner "Stopping Vagrant machine #{name.colorize(:cyan)} " do
            Open3.popen2('vagrant halt') do |stdin, output, wait|
              while o = output.gets
                print o if ENV['DEBUG']
              end
            end
          end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kontena-cli-0.14.7 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.6 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.5 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.4 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.14.0 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.4 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.13.0 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.12.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.12.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.12.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.12.0 lib/kontena/cli/nodes/vagrant/stop_command.rb