diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-07 08:04:44 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-12-07 13:27:30 -0800 |
commit | 00cdaff936a3d50ed7ea4eb9e0afa368403a1646 (patch) | |
tree | 689cfef9e74fefc10f78cecc1e24f1ec9c525d22 /lib/chef/resource/windows_task.rb | |
parent | a3642df60cc51c8b57bdfdc0cb12846215256c8f (diff) | |
download | chef-00cdaff936a3d50ed7ea4eb9e0afa368403a1646.tar.gz |
Validate that starttime is actually in HH:mm format
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/windows_task.rb')
-rw-r--r-- | lib/chef/resource/windows_task.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index 37a818c7fe..b879cbe6e0 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -109,10 +109,11 @@ class Chef end def validate_start_time(start_time, frequency) - if frequency == :once - raise ArgumentError, "`start_time` needs to be provided with `frequency :once`" unless start_time - elsif frequency == :none - raise ArgumentError, "`start_time` property is not supported with `frequency :none`" if start_time + if start_time + raise ArgumentError, "`start_time` property is not supported with `frequency :none`" if frequency == :none + raise ArgumentError, "`start_time` property must be in the HH:mm format." unless /^[0-2][0-3]:[0-5][0-9]$/ =~ start_time + else + raise ArgumentError, "`start_time` needs to be provided with `frequency :once`" if frequency == :once end end |