Sha256: 41bb543a3ff1a12a1ab72fa5245d7b73cd22c5c1f8e31cb642e105503f430ab0

Contents?: true

Size: 651 Bytes

Versions: 7

Compression:

Stored size: 651 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}/.kontena/vagrant_master"
      abort("Cannot find Vagrant kontena-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

7 entries across 7 versions & 2 rubygems

Version Path
krates-plugin-vagrant-0.3.3 lib/kontena/plugin/vagrant/master/ssh_command.rb
krates-plugin-vagrant-0.3.2 lib/kontena/plugin/vagrant/master/ssh_command.rb
krates-plugin-vagrant-0.3.1 lib/kontena/plugin/vagrant/master/ssh_command.rb
kontena-plugin-vagrant-0.3.1 lib/kontena/plugin/vagrant/master/ssh_command.rb
kontena-plugin-vagrant-0.3.0 lib/kontena/plugin/vagrant/master/ssh_command.rb
kontena-plugin-vagrant-0.2.7 lib/kontena/plugin/vagrant/master/ssh_command.rb
kontena-plugin-vagrant-0.2.6 lib/kontena/plugin/vagrant/master/ssh_command.rb