chef 0.10.6.beta.2 → 0.10.6.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/chef-solo.8.html +4 -4
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +4 -4
- data/distro/common/html/knife-cookbook-site.1.html +4 -4
- data/distro/common/html/knife-cookbook.1.html +4 -4
- data/distro/common/html/knife-data-bag.1.html +4 -4
- data/distro/common/html/knife-environment.1.html +4 -4
- data/distro/common/html/knife-exec.1.html +4 -4
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +4 -4
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +4 -4
- data/distro/common/html/knife-ssh.1.html +4 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +4 -4
- data/distro/common/html/shef.1.html +4 -4
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man1/shef.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/lib/chef/mixin/command.rb +0 -58
- data/lib/chef/provider/package/freebsd.rb +1 -1
- data/lib/chef/resource.rb +62 -40
- data/lib/chef/resource/conditional.rb +90 -0
- data/lib/chef/rest.rb +8 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- metadata +85 -40
@@ -0,0 +1,90 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/mixin/shell_out'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Resource
|
23
|
+
class Conditional
|
24
|
+
include Chef::Mixin::ShellOut
|
25
|
+
|
26
|
+
# We only create these via the `not_if` or `only_if` constructors, and
|
27
|
+
# not the default constructor
|
28
|
+
class << self
|
29
|
+
private :new
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.not_if(command=nil, command_opts={}, &block)
|
33
|
+
new(:not_if, command, command_opts, &block)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.only_if(command=nil, command_opts={}, &block)
|
37
|
+
new(:only_if, command, command_opts, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_reader :positivity
|
41
|
+
attr_reader :command
|
42
|
+
attr_reader :command_opts
|
43
|
+
attr_reader :block
|
44
|
+
|
45
|
+
def initialize(positivity, command=nil, command_opts={}, &block)
|
46
|
+
@positivity = positivity
|
47
|
+
case command
|
48
|
+
when String
|
49
|
+
@command, @command_opts = command, command_opts
|
50
|
+
@block = nil
|
51
|
+
when nil
|
52
|
+
raise ArgumentError, "only_if/not_if requires either a command or a block" unless block_given?
|
53
|
+
@command, @command_opts = nil, nil
|
54
|
+
@block = block
|
55
|
+
else
|
56
|
+
raise ArgumentError, "Invalid only_if/not_if command: #{command.inspect} (#{command.class})"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def continue?
|
61
|
+
case @positivity
|
62
|
+
when :only_if
|
63
|
+
evaluate
|
64
|
+
when :not_if
|
65
|
+
!evaluate
|
66
|
+
else
|
67
|
+
raise "Cannot evaluate resource conditional of type #{@positivity}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def evaluate
|
72
|
+
@command ? evaluate_command : evaluate_block
|
73
|
+
end
|
74
|
+
|
75
|
+
def evaluate_command
|
76
|
+
shell_out(@command, @command_opts).status.success?
|
77
|
+
end
|
78
|
+
|
79
|
+
def evaluate_block
|
80
|
+
@block.call
|
81
|
+
end
|
82
|
+
|
83
|
+
def description
|
84
|
+
cmd_or_block = @command ? "command `#{@command}`" : "ruby block"
|
85
|
+
"#{@positivity} #{cmd_or_block}"
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/chef/rest.rb
CHANGED
@@ -167,6 +167,10 @@ class Chef
|
|
167
167
|
# Will return the body of the response on success.
|
168
168
|
def run_request(method, url, headers={}, data=false, limit=nil, raw=false)
|
169
169
|
json_body = data ? Chef::JSONCompat.to_json(data) : nil
|
170
|
+
# Force encoding to binary to fix SSL related EOFErrors
|
171
|
+
# cf. http://tickets.opscode.com/browse/CHEF-2363
|
172
|
+
# http://redmine.ruby-lang.org/issues/5233
|
173
|
+
json_body.force_encoding(Encoding::BINARY) if json_body.respond_to?(:force_encoding)
|
170
174
|
headers = build_headers(method, url, headers, json_body, raw)
|
171
175
|
|
172
176
|
tf = nil
|
@@ -213,6 +217,10 @@ class Chef
|
|
213
217
|
# Runs an HTTP request to a JSON API. File Download not supported.
|
214
218
|
def api_request(method, url, headers={}, data=false)
|
215
219
|
json_body = data ? Chef::JSONCompat.to_json(data) : nil
|
220
|
+
# Force encoding to binary to fix SSL related EOFErrors
|
221
|
+
# cf. http://tickets.opscode.com/browse/CHEF-2363
|
222
|
+
# http://redmine.ruby-lang.org/issues/5233
|
223
|
+
json_body.force_encoding(Encoding::BINARY) if json_body.respond_to?(:force_encoding)
|
216
224
|
headers = build_headers(method, url, headers, json_body)
|
217
225
|
|
218
226
|
retriable_rest_request(method, url, json_body, headers) do |rest_request|
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/version_class.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.6.beta.
|
4
|
+
version: 0.10.6.beta.3
|
5
5
|
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-config
|
16
|
-
requirement: &
|
16
|
+
requirement: &70321173274180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70321173274180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mixlib-cli
|
27
|
-
requirement: &
|
27
|
+
requirement: &70321173273600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70321173273600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mixlib-log
|
38
|
-
requirement: &
|
38
|
+
requirement: &70321173272540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.3.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70321173272540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mixlib-authentication
|
49
|
-
requirement: &
|
49
|
+
requirement: &70321173271420 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70321173271420
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: ohai
|
60
|
-
requirement: &
|
60
|
+
requirement: &70321173270620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70321173270620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rest-client
|
71
|
-
requirement: &
|
71
|
+
requirement: &70321173269660 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -79,10 +79,10 @@ dependencies:
|
|
79
79
|
version: 1.7.0
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
|
-
version_requirements: *
|
82
|
+
version_requirements: *70321173269660
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bunny
|
85
|
-
requirement: &
|
85
|
+
requirement: &70321173268900 !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
88
88
|
- - ! '>='
|
@@ -90,10 +90,10 @@ dependencies:
|
|
90
90
|
version: 0.6.0
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
|
-
version_requirements: *
|
93
|
+
version_requirements: *70321173268900
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: json
|
96
|
-
requirement: &
|
96
|
+
requirement: &70321173268400 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ! '>='
|
@@ -104,10 +104,10 @@ dependencies:
|
|
104
104
|
version: 1.6.1
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
|
-
version_requirements: *
|
107
|
+
version_requirements: *70321173268400
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: treetop
|
110
|
-
requirement: &
|
110
|
+
requirement: &70321173267660 !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
113
113
|
- - ~>
|
@@ -115,10 +115,10 @@ dependencies:
|
|
115
115
|
version: 1.4.9
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
|
-
version_requirements: *
|
118
|
+
version_requirements: *70321173267660
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: net-ssh
|
121
|
-
requirement: &
|
121
|
+
requirement: &70321173267200 !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
124
|
- - ~>
|
@@ -126,10 +126,10 @@ dependencies:
|
|
126
126
|
version: 2.1.3
|
127
127
|
type: :runtime
|
128
128
|
prerelease: false
|
129
|
-
version_requirements: *
|
129
|
+
version_requirements: *70321173267200
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
131
|
name: net-ssh-multi
|
132
|
-
requirement: &
|
132
|
+
requirement: &70321173266740 !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|
135
135
|
- - ~>
|
@@ -137,10 +137,10 @@ dependencies:
|
|
137
137
|
version: 1.1.0
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
|
-
version_requirements: *
|
140
|
+
version_requirements: *70321173266740
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: erubis
|
143
|
-
requirement: &
|
143
|
+
requirement: &70321173266280 !ruby/object:Gem::Requirement
|
144
144
|
none: false
|
145
145
|
requirements:
|
146
146
|
- - ! '>='
|
@@ -148,10 +148,10 @@ dependencies:
|
|
148
148
|
version: '0'
|
149
149
|
type: :runtime
|
150
150
|
prerelease: false
|
151
|
-
version_requirements: *
|
151
|
+
version_requirements: *70321173266280
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
153
|
name: moneta
|
154
|
-
requirement: &
|
154
|
+
requirement: &70321173265840 !ruby/object:Gem::Requirement
|
155
155
|
none: false
|
156
156
|
requirements:
|
157
157
|
- - ! '>='
|
@@ -159,10 +159,10 @@ dependencies:
|
|
159
159
|
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
|
-
version_requirements: *
|
162
|
+
version_requirements: *70321173265840
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
name: highline
|
165
|
-
requirement: &
|
165
|
+
requirement: &70321173265400 !ruby/object:Gem::Requirement
|
166
166
|
none: false
|
167
167
|
requirements:
|
168
168
|
- - ! '>='
|
@@ -170,10 +170,10 @@ dependencies:
|
|
170
170
|
version: '0'
|
171
171
|
type: :runtime
|
172
172
|
prerelease: false
|
173
|
-
version_requirements: *
|
173
|
+
version_requirements: *70321173265400
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: uuidtools
|
176
|
-
requirement: &
|
176
|
+
requirement: &70321173265000 !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|
179
179
|
- - ! '>='
|
@@ -181,10 +181,54 @@ dependencies:
|
|
181
181
|
version: '0'
|
182
182
|
type: :runtime
|
183
183
|
prerelease: false
|
184
|
-
version_requirements: *
|
184
|
+
version_requirements: *70321173265000
|
185
|
+
- !ruby/object:Gem::Dependency
|
186
|
+
name: rdoc
|
187
|
+
requirement: &70321173264400 !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
type: :development
|
194
|
+
prerelease: false
|
195
|
+
version_requirements: *70321173264400
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
name: sdoc
|
198
|
+
requirement: &70321173264000 !ruby/object:Gem::Requirement
|
199
|
+
none: false
|
200
|
+
requirements:
|
201
|
+
- - ! '>='
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
type: :development
|
205
|
+
prerelease: false
|
206
|
+
version_requirements: *70321173264000
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: ronn
|
209
|
+
requirement: &70321173263600 !ruby/object:Gem::Requirement
|
210
|
+
none: false
|
211
|
+
requirements:
|
212
|
+
- - ! '>='
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
type: :development
|
216
|
+
prerelease: false
|
217
|
+
version_requirements: *70321173263600
|
218
|
+
- !ruby/object:Gem::Dependency
|
219
|
+
name: rake
|
220
|
+
requirement: &70321173263180 !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
222
|
+
requirements:
|
223
|
+
- - ! '>='
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: *70321173263180
|
185
229
|
- !ruby/object:Gem::Dependency
|
186
230
|
name: dep_selector
|
187
|
-
requirement: &
|
231
|
+
requirement: &70321173262780 !ruby/object:Gem::Requirement
|
188
232
|
none: false
|
189
233
|
requirements:
|
190
234
|
- - ! '>='
|
@@ -192,10 +236,10 @@ dependencies:
|
|
192
236
|
version: '0'
|
193
237
|
type: :development
|
194
238
|
prerelease: false
|
195
|
-
version_requirements: *
|
239
|
+
version_requirements: *70321173262780
|
196
240
|
- !ruby/object:Gem::Dependency
|
197
241
|
name: rspec-core
|
198
|
-
requirement: &
|
242
|
+
requirement: &70321173262380 !ruby/object:Gem::Requirement
|
199
243
|
none: false
|
200
244
|
requirements:
|
201
245
|
- - ! '>='
|
@@ -203,10 +247,10 @@ dependencies:
|
|
203
247
|
version: '0'
|
204
248
|
type: :development
|
205
249
|
prerelease: false
|
206
|
-
version_requirements: *
|
250
|
+
version_requirements: *70321173262380
|
207
251
|
- !ruby/object:Gem::Dependency
|
208
252
|
name: rspec-expectations
|
209
|
-
requirement: &
|
253
|
+
requirement: &70321173261980 !ruby/object:Gem::Requirement
|
210
254
|
none: false
|
211
255
|
requirements:
|
212
256
|
- - ! '>='
|
@@ -214,10 +258,10 @@ dependencies:
|
|
214
258
|
version: '0'
|
215
259
|
type: :development
|
216
260
|
prerelease: false
|
217
|
-
version_requirements: *
|
261
|
+
version_requirements: *70321173261980
|
218
262
|
- !ruby/object:Gem::Dependency
|
219
263
|
name: rspec-mocks
|
220
|
-
requirement: &
|
264
|
+
requirement: &70321173261580 !ruby/object:Gem::Requirement
|
221
265
|
none: false
|
222
266
|
requirements:
|
223
267
|
- - ! '>='
|
@@ -225,7 +269,7 @@ dependencies:
|
|
225
269
|
version: '0'
|
226
270
|
type: :development
|
227
271
|
prerelease: false
|
228
|
-
version_requirements: *
|
272
|
+
version_requirements: *70321173261580
|
229
273
|
description: A systems integration framework, built to bring the benefits of configuration
|
230
274
|
management to your entire infrastructure.
|
231
275
|
email: adam@opscode.com
|
@@ -593,6 +637,7 @@ files:
|
|
593
637
|
- lib/chef/resource/apt_package.rb
|
594
638
|
- lib/chef/resource/bash.rb
|
595
639
|
- lib/chef/resource/breakpoint.rb
|
640
|
+
- lib/chef/resource/conditional.rb
|
596
641
|
- lib/chef/resource/cookbook_file.rb
|
597
642
|
- lib/chef/resource/cron.rb
|
598
643
|
- lib/chef/resource/csh.rb
|