Class: ResourceIn::VMwareDriver

Inherits:
Driver
  • Object
show all
Defined in:
lib/resource_in/driver_vmware.rb

Constant Summary

Constants inherited from Driver

Driver::DETAIL_FORMAT, Driver::FORMAT, Driver::VALID_PATTERN

Instance Method Summary collapse

Methods inherited from Driver

#invoke, #validate_condition

Constructor Details

#initializeVMwareDriver

Returns a new instance of VMwareDriver.



6
7
8
9
10
11
# File 'lib/resource_in/driver_vmware.rb', line 6

def initialize
  @cmd_list = '/usr/local/bin/vmware_list_servers'
  @cmd_get = '/usr/local/bin/vmware_get_server'

  @cachepath = '/tmp/vmware_servers.cache'
end

Instance Method Details

#get(condition) ⇒ Object



17
18
19
20
21
# File 'lib/resource_in/driver_vmware.rb', line 17

def get(condition)
  validate_condition(condition)

  invoke("#{@cmd_get} #{condition}")
end

#listObject



12
13
14
15
16
# File 'lib/resource_in/driver_vmware.rb', line 12

def list
  invoke(@cmd_list, @cachepath).each do |d|
    d['status'] = d['status'] == 'green' ? 'ok' : 'warning'
  end
end