1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

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

This commit is contained in:
Alejandro Huertas Herrero 2020-06-22 13:09:49 +02:00 committed by GitHub
parent 8c30db905f
commit e81dc817f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)