Sha256: 3d0d878de9ba2b8e62ad1ad510be68adef5d7f5f2d018f627088964facfffc85

Contents?: true

Size: 740 Bytes

Versions: 22

Compression:

Stored size: 740 Bytes

Contents

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

    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

22 entries across 22 versions & 1 rubygems

Version Path
kontena-cli-0.11.7 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.6 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.5 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.4 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.11.0 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.10.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.10.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.10.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.10.0 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.9.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.9.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.9.1 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.9.0 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.8.4 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.8.3 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.8.2 lib/kontena/cli/nodes/vagrant/stop_command.rb
kontena-cli-0.8.1 lib/kontena/cli/nodes/vagrant/stop_command.rb