mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
B OpenNebula/one#6541: onedb fsck fix Scheduled Actions (#3020)
This commit is contained in:
parent
63ce359f94
commit
a89ae0069a
@ -34,25 +34,37 @@ 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
|
||||
|
||||
if update
|
||||
row[:body] = doc.root.to_s
|
||||
|
||||
@to_update << row
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Fix broken Scheduled Actions
|
||||
def fix_scheduled_actions
|
||||
|
Loading…
Reference in New Issue
Block a user