5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/dl_racktables/system.rb', line 5
def who_operate_vm_lastly(vmid)
resp = HTTP.get("index.php?page=search&last_page=object&last_tab=edit&q=#{vmid}")
doc = Nokogiri::HTML(resp.body)
if doc.title =~ /search results for/
return false
end
team = ''
if responsible_team = doc.xpath("//div[@class='portlet']//tr").find {|x| x.text =~ /b-10/}
team = responsible_team.xpath("td//select//option[@selected]").text
end
person = doc.xpath("//table[@class='cooltable']//tr").map {|x| x.children[1].text}.last
{team: team, person: person}
end
|