Class: Elesai::Megacli::LDPDinfo_aAll
- Inherits:
-
Megacli
- Object
- Megacli
- Elesai::Megacli::LDPDinfo_aAll
show all
- Defined in:
- lib/elesai/megacli/_ldpdinfo_aall.rb
Instance Method Summary
collapse
-
#adapter_line(adapter, key, value) ⇒ Object
-
#initialize ⇒ LDPDinfo_aAll
constructor
A new instance of LDPDinfo_aAll.
-
#on_adapter_entry(old_state, event, *args) ⇒ Object
-
#on_adapter_exit(new_state, event, *args) ⇒ Object
-
#on_physicaldrive_entry(old_state, event, *args) ⇒ Object
-
#on_physicaldrive_exit(new_state, event, *args) ⇒ Object
-
#on_virtualdrive_entry(old_state, event, *args) ⇒ Object
-
#on_virtualdrive_exit(new_state, event, *args) ⇒ Object
-
#parse!(lsi, opts) ⇒ Object
-
#physicaldrive_line(physicaldrive, key, value) ⇒ Object
-
#physicaldrive_match(k, match) ⇒ Object
-
#virtualdrive_line(virtualdrive, key, value) ⇒ Object
-
#virtualdrive_match(k, match) ⇒ Object
Regular Expression Match Handlers.
Methods inherited from Megacli
#adapter_match, #attribute_line, #attribute_match, #exit_line, #exit_match, #on_attribute_entry, #on_attribute_exit, #on_exit_entry, #on_start_exit
Constructor Details
Returns a new instance of LDPDinfo_aAll.
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 5
def initialize
@megacli = { :adapter => { :re => /^Adapter\s+#*(?<value>\d+)/, :method => self.method(:adapter_match) },
:virtualdrive => { :re => /^Virtual\s+Drive:\s+\d+\s+\((?<key>Target\s+Id):\s+(?<value>\d+)\)/, :method => self.method(:virtualdrive_match) },
:physicaldrive => { :re => /^(?<key>Enclosure\s+Device\s+ID):\s+(?<value>\d+)/, :method => self.method(:physicaldrive_match) },
:exit => { :re => /^Exit Code: /, :method => self.method(:exit_match) },
:attribute => { :re => /^(?<key>[A-Za-z0-9()\s#'-.&]+)[:|=](?<value>.*)/, :method => self.method(:attribute_match) }
}.freeze
@command_arguments = "-ldpdinfo -aall".freeze
@command_output_file = "ldpdinfo_aall".freeze
end
|
Instance Method Details
#adapter_line(adapter, key, value) ⇒ Object
39
40
41
42
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 39
def adapter_line(adapter,key,value)
@log.debug " [#{current_state}] event adapter_line: new #{adapter.inspect}"
adapter[key.to_sym] = value.to_i
end
|
#on_adapter_entry(old_state, event, *args) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 44
def on_adapter_entry(old_state, event, *args)
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
@context.close unless @context.current.nil? or Elesai::LSI::Adapter === @context.current
@context.open args[0]
end
|
#on_adapter_exit(new_state, event, *args) ⇒ Object
51
52
53
54
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 51
def on_adapter_exit(new_state, event, *args)
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
@context.flash!(new_state)
end
|
#on_physicaldrive_entry(old_state, event, *args) ⇒ Object
85
86
87
88
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 85
def on_physicaldrive_entry(old_state, event, *args)
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
@context.open args[0]
end
|
#on_physicaldrive_exit(new_state, event, *args) ⇒ Object
90
91
92
93
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 90
def on_physicaldrive_exit(new_state, event, *args)
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
@context.flash!(new_state)
end
|
#on_virtualdrive_entry(old_state, event, *args) ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 61
def on_virtualdrive_entry(old_state, event, *args)
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
unless @context.current.nil?
if Elesai::LSI::VirtualDrive === @context.current
@context.close
end
end
virtualdrive = args[0]
@context.open virtualdrive
end
|
#on_virtualdrive_exit(new_state, event, *args) ⇒ Object
73
74
75
76
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 73
def on_virtualdrive_exit(new_state, event, *args)
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
@context.flash!(new_state)
end
|
#parse!(lsi, opts) ⇒ Object
16
17
18
19
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 16
def parse!(lsi,opts)
fake = opts[:fake].nil? ? @command_arguments : File.join(opts[:fake],@command_output_file)
super lsi, :fake => fake, :megacli => opts[:megacli]
end
|
#physicaldrive_line(physicaldrive, key, value) ⇒ Object
80
81
82
83
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 80
def physicaldrive_line(physicaldrive,key,value)
@log.debug " [#{current_state}] event: physicaldrive_line: new #{physicaldrive.inspect}"
physicaldrive[key.to_sym] = value.to_i
end
|
#physicaldrive_match(k, match) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 30
def physicaldrive_match(k,match)
@log.debug "PHYSICALDRIVE! #{match.string}"
key = match[:key].gsub(/\s+/,"").downcase
value = match[:value]
physicaldrive_line!(LSI::PhysicalDrive.new,key,value)
end
|
#virtualdrive_line(virtualdrive, key, value) ⇒ Object
56
57
58
59
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 56
def virtualdrive_line(virtualdrive,key,value)
@log.debug " [#{current_state}] event: virtualdrive_line: new #{virtualdrive.inspect}"
virtualdrive[key.to_sym] = value.to_i
end
|
#virtualdrive_match(k, match) ⇒ Object
Regular Expression Match Handlers
23
24
25
26
27
28
|
# File 'lib/elesai/megacli/_ldpdinfo_aall.rb', line 23
def virtualdrive_match(k,match)
@log.debug "VIRTUALDRIVE! #{match.string}"
key = match[:key].gsub(/\s+/,"").downcase
value = match[:value]
virtualdrive_line!(LSI::VirtualDrive.new,key,value)
end
|