Class: ResourceIn::Driver
- Inherits:
-
Object
- Object
- ResourceIn::Driver
show all
- Defined in:
- lib/resource_in/driver.rb
Constant Summary
collapse
- FORMAT =
['name', 'address', 'status', 'location', 'boottime', 'created_by']
- DETAIL_FORMAT =
['name', 'address', 'status', 'location', 'boottime', 'created_by', 'cores', 'RAM', 'OS', 'Alarm']
Instance Method Summary
collapse
Instance Method Details
#invoke(command, cachepath = '/dev/null') ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/resource_in/driver.rb', line 8
def invoke(command, cachepath = '/dev/null')
cachepath.gsub!(' ', '_')
if !!cachepath and FileTest.exists?(cachepath) and not FileTest.zero?(cachepath)
JSON.parse(File.read(cachepath))
else
JSON.parse(`#{command} 2> /dev/null | tee #{cachepath}`)
end
end
|