1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-04-02 10:50:07 +03:00

Bug #2772: Fix onedb syntax for ruby < 1.9

This commit is contained in:
Carlos Martín 2014-03-07 16:43:19 +01:00
parent f1ac3d4765
commit 246ace7072
4 changed files with 18 additions and 18 deletions

View File

@ -336,8 +336,8 @@ EOT
new_elem = slave_doc.create_element("GROUPS")
groups_elem.xpath("ID").each do |id|
new_elem.add_child(slave_doc.create_element("ID"))
.content = groups[id.text.to_i][:oid]
new_elem.add_child(slave_doc.create_element("ID")).
content = groups[id.text.to_i][:oid]
end
slave_doc.root.add_child(new_elem)
@ -419,8 +419,8 @@ EOT
new_elem = slave_doc.create_element("USERS")
users_elem.xpath("ID").each do |id|
new_elem.add_child(slave_doc.create_element("ID"))
.content = users[id.text.to_i][:oid]
new_elem.add_child(slave_doc.create_element("ID")).
content = users[id.text.to_i][:oid]
end
slave_doc.root.add_child(new_elem)

View File

@ -51,9 +51,9 @@ module Migrator
@db.fetch("SELECT * FROM old_user_pool") do |row|
doc = Nokogiri::XML(row[:body])
doc.root.at_xpath("TEMPLATE")
.add_child(doc.create_element("TOKEN_PASSWORD"))
.content = OpenSSL::Digest::SHA1.hexdigest( rand().to_s )
doc.root.at_xpath("TEMPLATE").
add_child(doc.create_element("TOKEN_PASSWORD")).
content = OpenSSL::Digest::SHA1.hexdigest( rand().to_s )
@db[:user_pool].insert(
:oid => row[:oid],

View File

@ -295,8 +295,8 @@ http://opennebula.org/documentation:rel4.4:upgrade
@db.fetch("SELECT * FROM old_host_pool") do |row|
doc = Nokogiri::XML(row[:body])
doc.root.at_xpath("HOST_SHARE")
.add_child(doc.create_element("DATASTORES"))
doc.root.at_xpath("HOST_SHARE").
add_child(doc.create_element("DATASTORES"))
@db[:host_pool].insert(
:oid => row[:oid],

View File

@ -171,13 +171,13 @@ module Migrator
elem = doc.root.at_xpath("TEMPLATE/#{att}")
if !elem.nil?
elem.content = elem.text
.gsub("TOTALCPU", "MAX_CPU")
.gsub("TOTALMEMORY","MAX_MEM")
.gsub("FREECPU", "FREE_CPU")
.gsub("FREEMEMORY", "FREE_MEM")
.gsub("USEDCPU", "USED_CPU")
.gsub("USEDMEMORY", "USED_MEM")
elem.content = elem.text.
gsub("TOTALCPU", "MAX_CPU").
gsub("TOTALMEMORY","MAX_MEM").
gsub("FREECPU", "FREE_CPU").
gsub("FREEMEMORY", "FREE_MEM").
gsub("USEDCPU", "USED_CPU").
gsub("USEDMEMORY", "USED_MEM")
end
end
@ -218,8 +218,8 @@ module Migrator
quotas_doc = Nokogiri::XML("<QUOTAS></QUOTAS>")
quotas_doc.root.add_child(quotas_doc.create_element("ID"))
.content = doc.root.at_xpath("ID").text
quotas_doc.root.add_child(quotas_doc.create_element("ID")).
content = doc.root.at_xpath("ID").text
quotas_doc.root.add_child(ds_quota)
quotas_doc.root.add_child(net_quota)