summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2018-01-05 06:35:04 +0000
committerVasu1105 <vasundhara.jagdale@msystechnologies.com>2018-01-05 07:01:36 +0000
commit1a7fe48b1158a04ce354416d27fc70d81c82b670 (patch)
tree4b2e79c118a7d655f3c109def3371ccee5b571fa
parent84896c4e274d844356247d448b4d4c3fd2e1db61 (diff)
downloadchef-1a7fe48b1158a04ce354416d27fc70d81c82b670.tar.gz
Fixed review comments.
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r--lib/chef/provider/windows_task.rb4
-rw-r--r--lib/chef/resource/windows_task.rb9
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index 135c422df8..d8f9094fd1 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -253,7 +253,7 @@ class Chef
false
elsif current_resource.random_delay.nil? && new_resource.random_delay == "PT0S" # when user sets random_dealy to 0 sec
false
- elsif current_resource.random_delay.nil? && !new_resource.random_delay.nil?
+ elsif current_resource.random_delay.nil?
true
else
ISO8601::Duration.new(current_resource.random_delay) != ISO8601::Duration.new(new_resource.random_delay)
@@ -266,7 +266,7 @@ class Chef
false
elsif current_resource.execution_time_limit.nil? && new_resource.execution_time_limit == "PT0S" # when user sets random_dealy to 0 sec
false
- elsif current_resource.execution_time_limit.nil? && !new_resource.execution_time_limit.nil?
+ elsif current_resource.execution_time_limit.nil?
true
else
ISO8601::Duration.new(current_resource.execution_time_limit) != ISO8601::Duration.new(new_resource.execution_time_limit)
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb
index 6784f71f1d..14f5da46fa 100644
--- a/lib/chef/resource/windows_task.rb
+++ b/lib/chef/resource/windows_task.rb
@@ -205,12 +205,13 @@ class Chef
end
end
- # Converts the number of seconds to an ISO8601 duration format
+ # Converts the number of seconds to an ISO8601 duration format and returns it.
# Ref : https://github.com/arnau/ISO8601/blob/master/lib/iso8601/duration.rb#L18-L23
- # dur = ISO8601::Duration.new(65707200)
- # dur => 'P65707200S'
+ # e.g.
+ # ISO8601::Duration.new(65707200)
+ # returns 'P65707200S'
def sec_to_dur(seconds)
- dur = ISO8601::Duration.new(seconds.to_i).to_s
+ ISO8601::Duration.new(seconds.to_i).to_s
end
end