Sha256: de39e0a8bd6563507d9e1211df453655f8583b56d2a4d60675dce953b28fe5f1

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

module Kontena::Plugin::Vagrant::Nodes
  class RestartCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    parameter "NAME", "Node name"

    def execute
      require_api_url
      require_current_grid

      require_relative '../../../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
        spinner "Restarting Vagrant machine #{name.colorize(:cyan)} " do
          Open3.popen2('vagrant reload') do |stdin, output, wait|
            while o = output.gets
              print o if ENV['DEBUG']
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kontena-plugin-vagrant-0.2.7 lib/kontena/plugin/vagrant/nodes/restart_command.rb
kontena-plugin-vagrant-0.2.6 lib/kontena/plugin/vagrant/nodes/restart_command.rb
kontena-plugin-vagrant-0.2.5 lib/kontena/plugin/vagrant/nodes/restart_command.rb
kontena-plugin-vagrant-0.2.2 lib/kontena/plugin/vagrant/nodes/restart_command.rb
kontena-plugin-vagrant-0.2.1 lib/kontena/plugin/vagrant/nodes/restart_command.rb