Module: Lab::Controllers::RemoteWorkstationController

Included in:
VmController
Defined in:
lib/lab/controller/remote_workstation_controller.rb

Class Method Summary collapse

Class Method Details

.dir_list(basepath = nil) ⇒ Object



16
17
18
19
# File 'lib/lab/controller/remote_workstation_controller.rb', line 16

def self.dir_list(basepath=nil)
  vm_list = Find.find(basepath).select { |f| f =~ /\.vmx$/ }
  return vm_list
end

.running_list(user, host) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/lab/controller/remote_workstation_controller.rb', line 5

def self.running_list(user, host)
  user.gsub!(/(\W)*/, '')
  host.gsub!(/(\W)*/, '')

  remote_cmd = "ssh #{user}@#{host} \"vmrun list nogui\""
  vm_list = `#{remote_cmd}`.split("\n")
  vm_list.shift

  return vm_list
end