143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/lab/driver/remote_esxi_driver.rb', line 143
def get_snapshots
output = `ssh #{@user}@#{@host} \"vim-cmd vmsvc/snapshot.get #{@vmid}\"`
snapshots = []
current_tree = -1
current_num = 0
count = 0
output_lines = output.split("\n")
output_lines.each do |line|
if line.include?("|")
if line.include?("ROOT")
current_num = 0
current_tree = current_tree + 1
snapshots << { :name => [current_num, current_tree], :display_name => output_lines[count+1].split(":").last.strip }
else
current_num = current_num + 1
snapshots << { :name => [current_num, current_tree], :display_name => output_lines[count+1].split(":").last.strip }
end
end
count = count+1
end
snapshots
end
|