timed_rest_for_chef 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -0,0 +1,43 @@
1
+ TimedRestForChef
2
+ ================
3
+
4
+ This is a patching library to wrap REST calls in a
5
+ timeout to prevent hung chef processes.
6
+
7
+ Usage
8
+ =====
9
+
10
+ This library can be used in one of two ways:
11
+
12
+ 1. A cookbook recipe can load it via chef_gem
13
+ 2. The library can be required via the client.rb file
14
+
15
+ The first method would have something like this in a recipe:
16
+
17
+ ```ruby
18
+ chef_gem 'timed_rest_for_chef'
19
+ require 'timed_rest_for_chef'
20
+ ```
21
+
22
+ The downside of this method is that REST calls will not be wrapped
23
+ until chef gets to that recipe. This means all previous calls could
24
+ hang the chef process.
25
+
26
+ Using the second method, the gem will need to be available to chef,
27
+ and a new line added to the client.rb file:
28
+
29
+ ```ruby
30
+ # /etc/chef/client.rb
31
+ require 'timed_rest_for_chef'
32
+ ...
33
+ ```
34
+
35
+ Ensuring the gem is available to chef and that client.rb file has the
36
+ proper require line can be automated via the chef-client cookbook with
37
+ slight modifications.
38
+
39
+ References:
40
+ ===========
41
+
42
+ * Ticket: http://tickets.opscode.com/browse/CHEF-2944
43
+ * chef-client cookbook: https://github.com/opscode-cookbooks/chef-client/pull/12
@@ -1,7 +1,10 @@
1
1
  require 'timeout'
2
2
  require 'chef/rest/rest_request'
3
3
 
4
+ # Be optimistic for when this will get patched. We can release and
5
+ # updated gem if it doesn't make it until a later version
4
6
  if(Gem::Version.new(Chef::VERSION) < Gem::Version.new('10.14.0'))
7
+ Chef::Log.info "*** Adding timeout wrapper around REST requests"
5
8
 
6
9
  # Custom timeout class to make it easy to log
7
10
  # this specific type of timeout
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'timed_rest_for_chef'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.summary = 'Timed REST for Chef'
5
5
  s.author = 'Chris Roberts'
6
6
  s.email = 'chrisroberts.code@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timed_rest_for_chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: