summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2015-12-08 18:53:14 +0000
committerThom May <thom@may.lt>2015-12-08 18:53:14 +0000
commit1796116864c91ce68661df7a98c3a8c9f355d56f (patch)
tree0420d6862e665d150d84945da4ad35071155ea58 /lib/chef
parentd67fed62695c70a059fc815e4cafcbbee015126d (diff)
parent2c8d90c0eea2b014aba1699c677d9d42c850746b (diff)
downloadchef-1796116864c91ce68661df7a98c3a8c9f355d56f.tar.gz
Merge pull request #4236 from chef/jdm/dsc_resource_timeout
Add timeout attribute to dsc_resource
Diffstat (limited to 'lib/chef')
-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)