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

M #-: fix minor bug in sched actions (#30)

(cherry picked from commit e81dc817f6a82a9febd6fbbf1c4c1e32a0f7df3e)
This commit is contained in:
Alejandro Huertas Herrero 2020-06-22 13:09:49 +02:00 committed by Ruben S. Montero
parent b7ccbf5994
commit 95733d5248
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -453,8 +453,13 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
id = ids.max + 1
end
unless options[:schedule].include?('+')
options[:schedule] = options[:schedule].to_i
sched = options[:schedule]
# If the action is set to be executed from VM start to an specific
# amount of time later, we should preserve the + symbol
if ((sched.is_a? String) && !sched.include?('+')) ||
!(sched.is_a? String)
sched = sched.to_i
end
tmp_str = vm.user_template_str
@ -463,7 +468,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
tmp_str << "[ID = #{id}, ACTION = #{action}, "
tmp_str << "WARNING = #{warning}," if warning
tmp_str << "ARGS = \"#{options[:args]}\"," if options[:args]
tmp_str << "TIME = #{options[:schedule]}"
tmp_str << "TIME = #{sched}"
tmp_str << str_periodic << ']'
vm.update(tmp_str)