summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-12-03 21:34:29 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-12-03 21:40:16 -0800
commit2c8d90c0eea2b014aba1699c677d9d42c850746b (patch)
tree0c5abdfa453d9aaf6d1a7734fc89b055229f8b4f /lib
parent3c18cd94ec153b73441ef3e3f4bd3c82a7f24587 (diff)
downloadchef-2c8d90c0eea2b014aba1699c677d9d42c850746b.tar.gz
Add timeout attribute to dsc_resourcejdm/dsc_resource_timeout
`dsc_resource` was missing a timeout resource. Some resources, such as `xSQLServerSetup` were taking longer than the default of 10 minuites set by mixlib-shellout. Fixes #4232
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/dsc_resource.rb2
-rw-r--r--lib/chef/resource/dsc_resource.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index efbe4eccef..fd25a14ea5 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -154,7 +154,7 @@ class Chef
"Invoke-DscResource #{switches}",
output_format
)
- cmdlet.run!
+ cmdlet.run!({}, {:timeout => new_resource.timeout})
end
def return_dsc_resource_result(result, property_name)
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index 1dcde8de96..0664dc7d7f 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -89,7 +89,7 @@ class Chef
# This property takes the action message for the reboot resource
# If the set method of the DSC resource indicate that a reboot
- # is necessary, reboot_action provides the mechanism for a reboot to
+ # is necessary, reboot_action provides the mechanism for a reboot to
# be requested.
def reboot_action(value=nil)
if value
@@ -98,6 +98,14 @@ class Chef
@reboot_action
end
end
+
+ def timeout(arg=nil)
+ set_or_return(
+ :timeout,
+ arg,
+ :kind_of => [ Integer ]
+ )
+ end
private
def value_of(value)