chef 12.2.0.rc.1-x86-mingw32 → 12.2.0.rc.2-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook_manifest.rb +17 -3
- data/lib/chef/cookbook_version.rb +19 -0
- data/lib/chef/mixin/params_validate.rb +19 -42
- data/lib/chef/platform/provider_priority_map.rb +1 -0
- data/lib/chef/policy_builder/policyfile.rb +9 -5
- data/lib/chef/provider/deploy.rb +87 -104
- data/lib/chef/provider/dsc_resource.rb +1 -1
- data/lib/chef/provider/git.rb +0 -4
- data/lib/chef/provider/package/macports.rb +1 -0
- data/lib/chef/resource.rb +0 -9
- data/lib/chef/resource/deploy.rb +217 -52
- data/lib/chef/resource/git.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +8 -0
- data/lib/chef/resource/macports_package.rb +1 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/deploy_revision_spec.rb +0 -35
- data/spec/unit/cookbook/file_vendor_spec.rb +28 -8
- data/spec/unit/cookbook_manifest_spec.rb +19 -2
- data/spec/unit/cookbook_uploader_spec.rb +7 -1
- data/spec/unit/mixin/params_validate_spec.rb +61 -75
- data/spec/unit/policy_builder/policyfile_spec.rb +48 -13
- data/spec/unit/resource/deploy_spec.rb +0 -27
- metadata +2 -2
data/lib/chef/provider/git.rb
CHANGED
data/lib/chef/resource.rb
CHANGED
@@ -996,15 +996,6 @@ class Chef
|
|
996
996
|
end
|
997
997
|
end
|
998
998
|
|
999
|
-
#
|
1000
|
-
# DSL method used to define attribute on a resource wrapping params_validate
|
1001
|
-
#
|
1002
|
-
def self.attribute(attr_name, validation_opts={})
|
1003
|
-
define_method(attr_name) do |arg=NULL_ARG|
|
1004
|
-
nillable_set_or_return(attr_name.to_sym, arg, validation_opts)
|
1005
|
-
end
|
1006
|
-
end
|
1007
|
-
|
1008
999
|
#
|
1009
1000
|
# The cookbook in which this Resource was defined (if any).
|
1010
1001
|
#
|
data/lib/chef/resource/deploy.rb
CHANGED
@@ -63,7 +63,6 @@ class Chef
|
|
63
63
|
@deploy_to = name
|
64
64
|
@environment = nil
|
65
65
|
@repository_cache = 'cached-copy'
|
66
|
-
# XXX: if copy_exclude is a kind_of String why is initialized to an array???
|
67
66
|
@copy_exclude = []
|
68
67
|
@purge_before_symlink = %w{log tmp/pids public/system}
|
69
68
|
@create_dirs_before_symlink = %w{tmp public config}
|
@@ -79,11 +78,10 @@ class Chef
|
|
79
78
|
@scm_provider = Chef::Provider::Git
|
80
79
|
@svn_force_export = false
|
81
80
|
@allowed_actions.push(:force_deploy, :deploy, :rollback)
|
82
|
-
@additional_remotes =
|
81
|
+
@additional_remotes = Hash[]
|
83
82
|
@keep_releases = 5
|
84
83
|
@enable_checkout = true
|
85
84
|
@checkout_branch = "deploy"
|
86
|
-
@timeout = nil
|
87
85
|
end
|
88
86
|
|
89
87
|
# where the checked out/cloned code goes
|
@@ -106,18 +104,42 @@ class Chef
|
|
106
104
|
end
|
107
105
|
|
108
106
|
# note: deploy_to is your application "meta-root."
|
109
|
-
|
107
|
+
def deploy_to(arg=nil)
|
108
|
+
set_or_return(
|
109
|
+
:deploy_to,
|
110
|
+
arg,
|
111
|
+
:kind_of => [ String ]
|
112
|
+
)
|
113
|
+
end
|
110
114
|
|
111
|
-
|
115
|
+
def repo(arg=nil)
|
116
|
+
set_or_return(
|
117
|
+
:repo,
|
118
|
+
arg,
|
119
|
+
:kind_of => [ String ]
|
120
|
+
)
|
121
|
+
end
|
112
122
|
alias :repository :repo
|
113
123
|
|
114
|
-
|
124
|
+
def remote(arg=nil)
|
125
|
+
set_or_return(
|
126
|
+
:remote,
|
127
|
+
arg,
|
128
|
+
:kind_of => [ String ]
|
129
|
+
)
|
130
|
+
end
|
115
131
|
|
116
|
-
|
132
|
+
def role(arg=nil)
|
133
|
+
set_or_return(
|
134
|
+
:role,
|
135
|
+
arg,
|
136
|
+
:kind_of => [ String ]
|
137
|
+
)
|
138
|
+
end
|
117
139
|
|
118
|
-
def restart_command(arg=
|
119
|
-
arg
|
120
|
-
|
140
|
+
def restart_command(arg=nil, &block)
|
141
|
+
arg ||= block
|
142
|
+
set_or_return(
|
121
143
|
:restart_command,
|
122
144
|
arg,
|
123
145
|
:kind_of => [ String, Proc ]
|
@@ -125,60 +147,155 @@ class Chef
|
|
125
147
|
end
|
126
148
|
alias :restart :restart_command
|
127
149
|
|
128
|
-
|
150
|
+
def migrate(arg=nil)
|
151
|
+
set_or_return(
|
152
|
+
:migrate,
|
153
|
+
arg,
|
154
|
+
:kind_of => [ TrueClass, FalseClass ]
|
155
|
+
)
|
156
|
+
end
|
129
157
|
|
130
|
-
|
158
|
+
def migration_command(arg=nil)
|
159
|
+
set_or_return(
|
160
|
+
:migration_command,
|
161
|
+
arg,
|
162
|
+
:kind_of => [ String ]
|
163
|
+
)
|
164
|
+
end
|
131
165
|
|
132
|
-
|
166
|
+
def rollback_on_error(arg=nil)
|
167
|
+
set_or_return(
|
168
|
+
:rollback_on_error,
|
169
|
+
arg,
|
170
|
+
:kind_of => [ TrueClass, FalseClass ]
|
171
|
+
)
|
172
|
+
end
|
133
173
|
|
134
|
-
|
174
|
+
def user(arg=nil)
|
175
|
+
set_or_return(
|
176
|
+
:user,
|
177
|
+
arg,
|
178
|
+
:kind_of => [ String ]
|
179
|
+
)
|
180
|
+
end
|
135
181
|
|
136
|
-
|
182
|
+
def group(arg=nil)
|
183
|
+
set_or_return(
|
184
|
+
:group,
|
185
|
+
arg,
|
186
|
+
:kind_of => [ String ]
|
187
|
+
)
|
188
|
+
end
|
137
189
|
|
138
|
-
|
190
|
+
def enable_submodules(arg=nil)
|
191
|
+
set_or_return(
|
192
|
+
:enable_submodules,
|
193
|
+
arg,
|
194
|
+
:kind_of => [ TrueClass, FalseClass ]
|
195
|
+
)
|
196
|
+
end
|
139
197
|
|
140
|
-
|
198
|
+
def shallow_clone(arg=nil)
|
199
|
+
set_or_return(
|
200
|
+
:shallow_clone,
|
201
|
+
arg,
|
202
|
+
:kind_of => [ TrueClass, FalseClass ]
|
203
|
+
)
|
204
|
+
end
|
141
205
|
|
142
|
-
|
206
|
+
def repository_cache(arg=nil)
|
207
|
+
set_or_return(
|
208
|
+
:repository_cache,
|
209
|
+
arg,
|
210
|
+
:kind_of => [ String ]
|
211
|
+
)
|
212
|
+
end
|
143
213
|
|
144
|
-
|
214
|
+
def copy_exclude(arg=nil)
|
215
|
+
set_or_return(
|
216
|
+
:copy_exclude,
|
217
|
+
arg,
|
218
|
+
:kind_of => [ String ]
|
219
|
+
)
|
220
|
+
end
|
145
221
|
|
146
|
-
|
222
|
+
def revision(arg=nil)
|
223
|
+
set_or_return(
|
224
|
+
:revision,
|
225
|
+
arg,
|
226
|
+
:kind_of => [ String ]
|
227
|
+
)
|
228
|
+
end
|
147
229
|
alias :branch :revision
|
148
230
|
|
149
|
-
|
231
|
+
def git_ssh_wrapper(arg=nil)
|
232
|
+
set_or_return(
|
233
|
+
:git_ssh_wrapper,
|
234
|
+
arg,
|
235
|
+
:kind_of => [ String ]
|
236
|
+
)
|
237
|
+
end
|
150
238
|
alias :ssh_wrapper :git_ssh_wrapper
|
151
239
|
|
152
|
-
|
240
|
+
def svn_username(arg=nil)
|
241
|
+
set_or_return(
|
242
|
+
:svn_username,
|
243
|
+
arg,
|
244
|
+
:kind_of => [ String ]
|
245
|
+
)
|
246
|
+
end
|
153
247
|
|
154
|
-
|
248
|
+
def svn_password(arg=nil)
|
249
|
+
set_or_return(
|
250
|
+
:svn_password,
|
251
|
+
arg,
|
252
|
+
:kind_of => [ String ]
|
253
|
+
)
|
254
|
+
end
|
155
255
|
|
156
|
-
|
256
|
+
def svn_arguments(arg=nil)
|
257
|
+
set_or_return(
|
258
|
+
:svn_arguments,
|
259
|
+
arg,
|
260
|
+
:kind_of => [ String ]
|
261
|
+
)
|
262
|
+
end
|
157
263
|
|
158
|
-
|
264
|
+
def svn_info_args(arg=nil)
|
265
|
+
set_or_return(
|
266
|
+
:svn_arguments,
|
267
|
+
arg,
|
268
|
+
:kind_of => [ String ])
|
269
|
+
end
|
159
270
|
|
160
|
-
def scm_provider(arg=
|
271
|
+
def scm_provider(arg=nil)
|
161
272
|
klass = if arg.kind_of?(String) || arg.kind_of?(Symbol)
|
162
273
|
lookup_provider_constant(arg)
|
163
274
|
else
|
164
275
|
arg
|
165
276
|
end
|
166
|
-
|
277
|
+
set_or_return(
|
167
278
|
:scm_provider,
|
168
279
|
klass,
|
169
280
|
:kind_of => [ Class ]
|
170
281
|
)
|
171
282
|
end
|
172
283
|
|
173
|
-
|
284
|
+
def svn_force_export(arg=nil)
|
285
|
+
set_or_return(
|
286
|
+
:svn_force_export,
|
287
|
+
arg,
|
288
|
+
:kind_of => [ TrueClass, FalseClass ]
|
289
|
+
)
|
290
|
+
end
|
174
291
|
|
175
|
-
def environment(arg=
|
292
|
+
def environment(arg=nil)
|
176
293
|
if arg.is_a?(String)
|
177
294
|
Chef::Log.debug "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'"
|
178
295
|
Chef::Log.warn "[DEPRECATED] please modify your deploy recipe or attributes to set the environment using a hash"
|
179
296
|
arg = {"RAILS_ENV"=>arg,"MERB_ENV"=>arg,"RACK_ENV"=>arg}
|
180
297
|
end
|
181
|
-
|
298
|
+
set_or_return(
|
182
299
|
:environment,
|
183
300
|
arg,
|
184
301
|
:kind_of => [ Hash ]
|
@@ -186,8 +303,8 @@ class Chef
|
|
186
303
|
end
|
187
304
|
|
188
305
|
# The number of old release directories to keep around after cleanup
|
189
|
-
def keep_releases(arg=
|
190
|
-
[
|
306
|
+
def keep_releases(arg=nil)
|
307
|
+
[set_or_return(
|
191
308
|
:keep_releases,
|
192
309
|
arg,
|
193
310
|
:kind_of => [ Integer ]), 1].max
|
@@ -197,7 +314,13 @@ class Chef
|
|
197
314
|
# SCM clone/checkout before symlinking. Use this to get rid of files and
|
198
315
|
# directories you want to be shared between releases.
|
199
316
|
# Default: ["log", "tmp/pids", "public/system"]
|
200
|
-
|
317
|
+
def purge_before_symlink(arg=nil)
|
318
|
+
set_or_return(
|
319
|
+
:purge_before_symlink,
|
320
|
+
arg,
|
321
|
+
:kind_of => Array
|
322
|
+
)
|
323
|
+
end
|
201
324
|
|
202
325
|
# An array of paths, relative to your app's root, where you expect dirs to
|
203
326
|
# exist before symlinking. This runs after #purge_before_symlink, so you
|
@@ -207,7 +330,13 @@ class Chef
|
|
207
330
|
# then specify tmp here so that the tmp directory will exist when you
|
208
331
|
# symlink the pids directory in to the current release.
|
209
332
|
# Default: ["tmp", "public", "config"]
|
210
|
-
|
333
|
+
def create_dirs_before_symlink(arg=nil)
|
334
|
+
set_or_return(
|
335
|
+
:create_dirs_before_symlink,
|
336
|
+
arg,
|
337
|
+
:kind_of => Array
|
338
|
+
)
|
339
|
+
end
|
211
340
|
|
212
341
|
# A Hash of shared/dir/path => release/dir/path. This attribute determines
|
213
342
|
# which files and dirs in the shared directory get symlinked to the current
|
@@ -215,7 +344,13 @@ class Chef
|
|
215
344
|
# $shared/pids that you would like to symlink as $current_release/tmp/pids
|
216
345
|
# you specify it as "pids" => "tmp/pids"
|
217
346
|
# Default {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}
|
218
|
-
|
347
|
+
def symlinks(arg=nil)
|
348
|
+
set_or_return(
|
349
|
+
:symlinks,
|
350
|
+
arg,
|
351
|
+
:kind_of => Hash
|
352
|
+
)
|
353
|
+
end
|
219
354
|
|
220
355
|
# A Hash of shared/dir/path => release/dir/path. This attribute determines
|
221
356
|
# which files in the shared directory get symlinked to the current release
|
@@ -224,44 +359,74 @@ class Chef
|
|
224
359
|
# For a rails/merb app, this is used to link in a known good database.yml
|
225
360
|
# (with the production db password) before running migrate.
|
226
361
|
# Default {"config/database.yml" => "config/database.yml"}
|
227
|
-
|
362
|
+
def symlink_before_migrate(arg=nil)
|
363
|
+
set_or_return(
|
364
|
+
:symlink_before_migrate,
|
365
|
+
arg,
|
366
|
+
:kind_of => Hash
|
367
|
+
)
|
368
|
+
end
|
228
369
|
|
229
370
|
# Callback fires before migration is run.
|
230
|
-
def before_migrate(arg=
|
231
|
-
arg
|
232
|
-
|
371
|
+
def before_migrate(arg=nil, &block)
|
372
|
+
arg ||= block
|
373
|
+
set_or_return(:before_migrate, arg, :kind_of => [Proc, String])
|
233
374
|
end
|
234
375
|
|
235
376
|
# Callback fires before symlinking
|
236
|
-
def before_symlink(arg=
|
237
|
-
arg
|
238
|
-
|
377
|
+
def before_symlink(arg=nil, &block)
|
378
|
+
arg ||= block
|
379
|
+
set_or_return(:before_symlink, arg, :kind_of => [Proc, String])
|
239
380
|
end
|
240
381
|
|
241
382
|
# Callback fires before restart
|
242
|
-
def before_restart(arg=
|
243
|
-
arg
|
244
|
-
|
383
|
+
def before_restart(arg=nil, &block)
|
384
|
+
arg ||= block
|
385
|
+
set_or_return(:before_restart, arg, :kind_of => [Proc, String])
|
245
386
|
end
|
246
387
|
|
247
388
|
# Callback fires after restart
|
248
|
-
def after_restart(arg=
|
249
|
-
arg
|
250
|
-
|
389
|
+
def after_restart(arg=nil, &block)
|
390
|
+
arg ||= block
|
391
|
+
set_or_return(:after_restart, arg, :kind_of => [Proc, String])
|
251
392
|
end
|
252
393
|
|
253
|
-
|
394
|
+
def additional_remotes(arg=nil)
|
395
|
+
set_or_return(
|
396
|
+
:additional_remotes,
|
397
|
+
arg,
|
398
|
+
:kind_of => Hash
|
399
|
+
)
|
400
|
+
end
|
254
401
|
|
255
|
-
|
402
|
+
def enable_checkout(arg=nil)
|
403
|
+
set_or_return(
|
404
|
+
:enable_checkout,
|
405
|
+
arg,
|
406
|
+
:kind_of => [TrueClass, FalseClass]
|
407
|
+
)
|
408
|
+
end
|
256
409
|
|
257
|
-
|
410
|
+
def checkout_branch(arg=nil)
|
411
|
+
set_or_return(
|
412
|
+
:checkout_branch,
|
413
|
+
arg,
|
414
|
+
:kind_of => String
|
415
|
+
)
|
416
|
+
end
|
258
417
|
|
259
418
|
# FIXME The Deploy resource may be passed to an SCM provider as its
|
260
419
|
# resource. The SCM provider knows that SCM resources can specify a
|
261
420
|
# timeout for SCM operations. The deploy resource must therefore support
|
262
421
|
# a timeout method, but the timeout it describes is for SCM operations,
|
263
422
|
# not the overall deployment. This is potentially confusing.
|
264
|
-
|
423
|
+
def timeout(arg=nil)
|
424
|
+
set_or_return(
|
425
|
+
:timeout,
|
426
|
+
arg,
|
427
|
+
:kind_of => Integer
|
428
|
+
)
|
429
|
+
end
|
265
430
|
|
266
431
|
end
|
267
432
|
end
|
data/lib/chef/resource/git.rb
CHANGED
@@ -70,6 +70,14 @@ class Chef
|
|
70
70
|
alias_method :resource_name=, :resource_name
|
71
71
|
end
|
72
72
|
|
73
|
+
# Define an attribute on this resource, including optional validation
|
74
|
+
# parameters.
|
75
|
+
def self.attribute(attr_name, validation_opts={})
|
76
|
+
define_method(attr_name) do |arg=nil|
|
77
|
+
set_or_return(attr_name.to_sym, arg, validation_opts)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
73
81
|
# Sets the default action
|
74
82
|
def self.default_action(action_name=NULL_ARG)
|
75
83
|
unless action_name.equal?(NULL_ARG)
|