Class: VagrantPlugins::Vagga::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vagga/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



5
6
7
# File 'lib/vagrant-vagga/command.rb', line 5

def self.synopsis
  'executes vagga commands in virtual machine'
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant-vagga/command.rb', line 11

def execute
  args = @argv.join(' ')
  vagga_command = "/tmp/exec_vagga.sh #{args}"

  with_target_vms(nil, single_target: true) do |vm|
    vm.action(:up)

    @logger.info("Executing vagga command on remote machine: #{vagga_command}")
    ssh_opts = {extra_args: ['-q']} # make it quiet
    env = vm.action(:ssh_run, ssh_run_command: vagga_command, ssh_opts: ssh_opts)

    status = env[:ssh_run_exit_status] || 0
    return status
  end
end