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

Fix bug in migrator from beta or RC

This commit is contained in:
Carlos Martín 2014-04-25 15:38:19 +02:00
parent a6701b046e
commit 2daaf7a6e9

View File

@ -26,16 +26,25 @@ module Migrator
end
def up
last_oid = -1
@db.fetch("SELECT last_oid FROM pool_control WHERE tablename='acl'") do |row|
last_oid = row[:last_oid].to_i
found = false
@db.fetch("SELECT oid FROM acl WHERE user=17179869184 and resource=140754668224512 and rights=1 and zone=17179869184") do |row|
found = true
end
# * ZONE/* USE *
@db.run "INSERT INTO acl VALUES(#{last_oid+1},17179869184,140754668224512,1,17179869184);"
if !found
last_oid = -1
@db.run "REPLACE INTO pool_control VALUES('acl', #{last_oid+1});"
@db.fetch("SELECT last_oid FROM pool_control WHERE tablename='acl'") do |row|
last_oid = row[:last_oid].to_i
end
# * ZONE/* USE *
@db.run "INSERT INTO acl VALUES(#{last_oid+1},17179869184,140754668224512,1,17179869184);"
@db.run "REPLACE INTO pool_control VALUES('acl', #{last_oid+1});"
end
return true
end