summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-07-17 18:13:09 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-07-26 14:42:39 +0530
commitd985b6032c1949a0b5d27cf1d3ae370246dd6f68 (patch)
treead2120d582485e9851c89946891e98e631e00ab4
parent88ebfbefa40ee3e41cd43f9c89f7dd82dc9c9dde (diff)
downloadchef-d985b6032c1949a0b5d27cf1d3ae370246dd6f68.tar.gz
[MSYS-854]support for task on battery
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/provider/windows_task.rb2
-rw-r--r--lib/chef/resource/windows_task.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index 045e418c7a..85a5941726 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -552,6 +552,8 @@ class Chef
settings[:idle_duration] = new_resource.idle_time if new_resource.idle_time
settings[:run_only_if_idle] = true if new_resource.idle_time
settings[:priority] = new_resource.priority
+ settings[:disallow_start_if_on_batteries] = new_resource.disallow_start_on_battery
+ settings[:stop_if_going_on_batteries] = new_resource.stop_on_battery
settings
end
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb
index 97ade20774..06e7cb3a65 100644
--- a/lib/chef/resource/windows_task.rb
+++ b/lib/chef/resource/windows_task.rb
@@ -61,6 +61,8 @@ class Chef
property :minutes_interval, [String, Integer]
property :priority, Integer, description: "Use to set Priority Levels range from 0 to 10.", default: 7,
callbacks: { "should be in range of 0 to 10" => proc { |v| v >= 0 && v <= 10 } }
+ property :disallow_start_on_battery, [TrueClass, FalseClass], default: false
+ property :stop_on_battery, [TrueClass, FalseClass], default: false
attr_accessor :exists, :task, :command_arguments