mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B #5492: change-body modifies db instead of API data
(cherry picked from commit c631781bef710a50e6648f01ed274f07a91743dc)
This commit is contained in:
parent
0466a376c3
commit
575530bfac
@ -343,8 +343,20 @@ class OneDBLive
|
||||
next unless check_expr(o, options[:expr])
|
||||
end
|
||||
|
||||
o.info
|
||||
doc = Nokogiri::XML(o.to_xml, nil, NOKOGIRI_ENCODING) do |c|
|
||||
# Get body from the database
|
||||
begin
|
||||
db_data = select(table, "oid = #{o.id}")
|
||||
rescue => e
|
||||
STDERR.puts "Error getting object id #{o.id}"
|
||||
STDERR.puts e.message
|
||||
STDERR.puts e.backtrace
|
||||
next
|
||||
end
|
||||
|
||||
row = db_data.first
|
||||
body = Base64.decode64(row['body64'])
|
||||
|
||||
doc = Nokogiri::XML(body, nil, NOKOGIRI_ENCODING) do |c|
|
||||
c.default_xml.noblanks
|
||||
end
|
||||
|
||||
@ -361,7 +373,14 @@ class OneDBLive
|
||||
if options[:dry]
|
||||
puts xml
|
||||
else
|
||||
update_body(table, xml, "oid = #{o.id}", federate)
|
||||
begin
|
||||
update_body(table, xml, "oid = #{o.id}", federate)
|
||||
rescue => e
|
||||
STDERR.puts "Error updating object id #{o.id}"
|
||||
STDERR.puts e.message
|
||||
STDERR.puts e.backtrace
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user