Class: Elesai::Megacli::PDlist_aAll
- Inherits:
-
Megacli
- Object
- Megacli
- Elesai::Megacli::PDlist_aAll
show all
- Defined in:
- lib/elesai/megacli/_pdlist_aall.rb
Instance Method Summary
collapse
-
#initialize ⇒ PDlist_aAll
constructor
A new instance of PDlist_aAll.
-
#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
Methods inherited from Megacli
#adapter_line, #adapter_match, #attribute_line, #attribute_match, #exit_line, #exit_match, #on_adapter_entry, #on_adapter_exit, #on_attribute_entry, #on_attribute_exit, #on_exit_entry, #on_start_exit
Constructor Details
Returns a new instance of PDlist_aAll.
5
6
7
8
9
10
11
12
13
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 5
def initialize
@megacli = { :adapter => { :re => /^Adapter\s+#*(?<value>\d+)/, :method => self.method(:adapter_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 = "-pdlist -aall".freeze
@command_output_file = "pdlist_aall".freeze
end
|
Instance Method Details
#on_physicaldrive_entry(old_state, event, *args) ⇒ Object
108
109
110
111
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 108
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
113
114
115
116
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 113
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
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 84
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
96
97
98
99
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 96
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
15
16
17
18
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 15
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
103
104
105
106
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 103
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
68
69
70
71
72
73
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 68
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
79
80
81
82
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 79
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
61
62
63
64
65
66
|
# File 'lib/elesai/megacli/_pdlist_aall.rb', line 61
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
|