1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

B OpenNebula/one#6541: onedb fsck fix Scheduled Actions (#3020)

This commit is contained in:
Pavel Czerný 2024-04-15 12:01:31 +02:00 committed by GitHub
parent 63ce359f94
commit a89ae0069a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,23 +34,35 @@ module OneDBFsck
query = 'SELECT * FROM schedaction_pool;'
@db.fetch(query) do |row|
update = false
doc = nokogiri_doc(row[:body], 'schedaction_pool')
optional_args = ['MESSAGE', 'ARGS']
optional_args.each do |att_name|
optional_args = { 'MESSAGE' => '',
'ARGS' => '',
'DONE' => -1,
'REPEAT' => -1,
'DAYS' => '',
'END_TYPE' => -1,
'END_VALUE' => -1 }
optional_args.each do |att_name, default_value|
att = doc.root.at_xpath(att_name)
next unless att.nil?
update = true
log_error("Scheduled action #{row[:oid]} doesn't have '#{att_name}' attribute",
true)
att = doc.create_element(att_name)
doc.root.add_child(att).content = ''
doc.root.add_child(att).content = default_value
end
row[:body] = doc.root.to_s
if update
row[:body] = doc.root.to_s
@to_update << row
@to_update << row
end
end
end