Sha256: f71fc5077e36dbb6b0f88dfbdf12e6bd3232b8496d566a44d96f47dee494ce64

Contents?: true

Size: 649 Bytes

Versions: 3

Compression:

Stored size: 649 Bytes

Contents

module Kontena::Plugin::Vagrant::Master
  class SshCommand < Kontena::Command
    include Kontena::Cli::Common

    parameter "[COMMANDS] ...", "Run command on Master"

    def execute
      require 'shellwords'
      require_relative '../../../machine/vagrant'

      vagrant_path = "#{Dir.home}/.krates/vagrant_master"
      abort("Cannot find Vagrant krates-master".colorize(:red)) unless Dir.exist?(vagrant_path)

      cmd = "vagrant ssh"
      if self.commands_list && !self.commands_list.empty?
        cmd << " -c '#{self.commands_list.shelljoin}'"
      end

      Dir.chdir(vagrant_path) do
        system(cmd)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
krates-plugin-vagrant-0.3.6 lib/kontena/plugin/vagrant/master/ssh_command.rb
krates-plugin-vagrant-0.3.5 lib/kontena/plugin/vagrant/master/ssh_command.rb
krates-plugin-vagrant-0.3.4 lib/kontena/plugin/vagrant/master/ssh_command.rb