chef 12.1.2 → 12.2.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/chef/application/client.rb +2 -2
- data/lib/chef/audit/audit_reporter.rb +1 -1
- data/lib/chef/audit/runner.rb +15 -2
- data/lib/chef/client.rb +1 -1
- data/lib/chef/config.rb +6 -4
- data/lib/chef/dsl/powershell.rb +29 -0
- data/lib/chef/exceptions.rb +18 -3
- data/lib/chef/formatters/doc.rb +2 -2
- data/lib/chef/knife/bootstrap.rb +2 -1
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +13 -5
- data/lib/chef/knife/exec.rb +2 -1
- data/lib/chef/knife/ssh.rb +12 -2
- data/lib/chef/mixin/params_validate.rb +42 -19
- data/lib/chef/mixin/powershell_type_coercions.rb +82 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +8 -0
- data/lib/chef/node.rb +1 -1
- data/lib/chef/platform/provider_mapping.rb +0 -107
- data/lib/chef/platform/query_helpers.rb +7 -0
- data/lib/chef/provider/batch.rb +2 -0
- data/lib/chef/provider/cron.rb +2 -0
- data/lib/chef/provider/cron/aix.rb +2 -0
- data/lib/chef/provider/cron/unix.rb +2 -0
- data/lib/chef/provider/deploy.rb +104 -87
- data/lib/chef/provider/dsc_resource.rb +157 -0
- data/lib/chef/provider/env.rb +2 -0
- data/lib/chef/provider/env/windows.rb +2 -0
- data/lib/chef/provider/git.rb +4 -0
- data/lib/chef/provider/group.rb +5 -5
- data/lib/chef/provider/group/dscl.rb +2 -0
- data/lib/chef/provider/group/groupmod.rb +2 -0
- data/lib/chef/provider/group/usermod.rb +2 -0
- data/lib/chef/provider/group/windows.rb +2 -0
- data/lib/chef/provider/mdadm.rb +2 -0
- data/lib/chef/provider/mount/windows.rb +2 -0
- data/lib/chef/provider/package/homebrew.rb +1 -1
- data/lib/chef/provider/package/openbsd.rb +49 -18
- data/lib/chef/provider/package/rubygems.rb +7 -2
- data/lib/chef/provider/powershell_script.rb +2 -0
- data/lib/chef/provider/service/macosx.rb +1 -2
- data/lib/chef/provider/user/dscl.rb +7 -1
- data/lib/chef/provider/user/windows.rb +2 -0
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/recipe.rb +2 -0
- data/lib/chef/resource.rb +9 -0
- data/lib/chef/resource/batch.rb +2 -0
- data/lib/chef/resource/cron.rb +3 -3
- data/lib/chef/resource/deploy.rb +52 -217
- data/lib/chef/resource/dsc_resource.rb +83 -0
- data/lib/chef/resource/env.rb +2 -0
- data/lib/chef/resource/git.rb +1 -1
- data/lib/chef/resource/group.rb +2 -0
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +0 -8
- data/lib/chef/resource/mdadm.rb +2 -0
- data/lib/chef/resource/mount.rb +2 -0
- data/lib/chef/resource/powershell_script.rb +2 -0
- data/lib/chef/resource/user.rb +2 -0
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_context.rb +1 -1
- data/lib/chef/shell.rb +7 -5
- data/lib/chef/util/dsc/resource_store.rb +110 -0
- data/lib/chef/util/path_helper.rb +76 -0
- data/lib/chef/util/powershell/cmdlet.rb +41 -7
- data/lib/chef/util/powershell/cmdlet_result.rb +18 -3
- data/lib/chef/util/powershell/ps_credential.rb +38 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +2 -0
- data/lib/chef/win32/api/crypto.rb +63 -0
- data/lib/chef/win32/api/installer.rb +1 -1
- data/lib/chef/win32/crypto.rb +49 -0
- data/lib/chef/workstation_config_loader.rb +4 -3
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/deploy_revision_spec.rb +35 -0
- data/spec/functional/resource/directory_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +93 -0
- data/spec/functional/resource/env_spec.rb +4 -3
- data/spec/functional/resource/file_spec.rb +1 -1
- data/spec/functional/resource/powershell_spec.rb +2 -1
- data/spec/functional/resource/remote_directory_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/template_spec.rb +1 -1
- data/spec/functional/resource/user/dscl_spec.rb +1 -2
- data/spec/functional/resource/user/useradd_spec.rb +27 -13
- data/spec/functional/util/powershell/cmdlet_spec.rb +3 -3
- data/spec/functional/win32/crypto_spec.rb +57 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/platform_helpers.rb +14 -0
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +5 -5
- data/spec/unit/application/client_spec.rb +4 -4
- data/spec/unit/audit/audit_reporter_spec.rb +1 -1
- data/spec/unit/audit/runner_spec.rb +10 -0
- data/spec/unit/config_spec.rb +2 -8
- data/spec/unit/knife/bootstrap_spec.rb +20 -8
- data/spec/unit/knife/core/subcommand_loader_spec.rb +29 -29
- data/spec/unit/mixin/params_validate_spec.rb +75 -61
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +72 -0
- data/spec/unit/platform/query_helpers_spec.rb +22 -0
- data/spec/unit/platform_spec.rb +0 -5
- data/spec/unit/provider/dsc_resource_spec.rb +84 -0
- data/spec/unit/provider/package/openbsd_spec.rb +105 -17
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider_resolver_spec.rb +132 -0
- data/spec/unit/recipe_spec.rb +4 -0
- data/spec/unit/resource/deploy_spec.rb +27 -0
- data/spec/unit/resource/dsc_resource_spec.rb +85 -0
- data/spec/unit/shell_spec.rb +1 -1
- data/spec/unit/util/dsc/resource_store.rb +76 -0
- data/spec/unit/util/powershell/ps_credential_spec.rb +37 -0
- data/spec/unit/workstation_config_loader_spec.rb +1 -1
- metadata +159 -186
@@ -44,6 +44,8 @@ class Chef
|
|
44
44
|
# This provider only supports Mac OSX versions 10.7 and above
|
45
45
|
class Dscl < Chef::Provider::User
|
46
46
|
|
47
|
+
provides :user, os: "darwin"
|
48
|
+
|
47
49
|
def define_resource_requirements
|
48
50
|
super
|
49
51
|
|
@@ -650,7 +652,11 @@ user password using shadow hash.")
|
|
650
652
|
def run_plutil(*args)
|
651
653
|
result = shell_out("plutil -#{args.join(' ')}")
|
652
654
|
raise(Chef::Exceptions::PlistUtilCommandFailed,"plutil error: #{result.inspect}") unless result.exitstatus == 0
|
653
|
-
result.stdout
|
655
|
+
if result.stdout.encoding == Encoding::ASCII_8BIT
|
656
|
+
result.stdout.encode("utf-8", "binary", :undef => :replace, :invalid => :replace, :replace => '?')
|
657
|
+
else
|
658
|
+
result.stdout
|
659
|
+
end
|
654
660
|
end
|
655
661
|
|
656
662
|
def convert_binary_plist_to_xml(binary_plist_string)
|
data/lib/chef/providers.rb
CHANGED
@@ -25,6 +25,7 @@ require 'chef/provider/cron/aix'
|
|
25
25
|
require 'chef/provider/deploy'
|
26
26
|
require 'chef/provider/directory'
|
27
27
|
require 'chef/provider/dsc_script'
|
28
|
+
require 'chef/provider/dsc_resource'
|
28
29
|
require 'chef/provider/env'
|
29
30
|
require 'chef/provider/erl_call'
|
30
31
|
require 'chef/provider/execute'
|
data/lib/chef/recipe.rb
CHANGED
@@ -25,6 +25,7 @@ require 'chef/dsl/include_recipe'
|
|
25
25
|
require 'chef/dsl/registry_helper'
|
26
26
|
require 'chef/dsl/reboot_pending'
|
27
27
|
require 'chef/dsl/audit'
|
28
|
+
require 'chef/dsl/powershell'
|
28
29
|
|
29
30
|
require 'chef/mixin/from_file'
|
30
31
|
|
@@ -42,6 +43,7 @@ class Chef
|
|
42
43
|
include Chef::DSL::RegistryHelper
|
43
44
|
include Chef::DSL::RebootPending
|
44
45
|
include Chef::DSL::Audit
|
46
|
+
include Chef::DSL::Powershell
|
45
47
|
|
46
48
|
include Chef::Mixin::FromFile
|
47
49
|
include Chef::Mixin::Deprecation
|
data/lib/chef/resource.rb
CHANGED
@@ -996,6 +996,15 @@ 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
|
+
|
999
1008
|
#
|
1000
1009
|
# The cookbook in which this Resource was defined (if any).
|
1001
1010
|
#
|
data/lib/chef/resource/batch.rb
CHANGED
data/lib/chef/resource/cron.rb
CHANGED
@@ -27,6 +27,8 @@ class Chef
|
|
27
27
|
|
28
28
|
state_attrs :minute, :hour, :day, :month, :weekday, :user
|
29
29
|
|
30
|
+
provides :cron
|
31
|
+
|
30
32
|
def initialize(name, run_context=nil)
|
31
33
|
super
|
32
34
|
@resource_name = :cron
|
@@ -138,7 +140,7 @@ class Chef
|
|
138
140
|
:kind_of => [String, Symbol]
|
139
141
|
)
|
140
142
|
end
|
141
|
-
|
143
|
+
|
142
144
|
def time(arg=nil)
|
143
145
|
set_or_return(
|
144
146
|
:time,
|
@@ -214,5 +216,3 @@ class Chef
|
|
214
216
|
end
|
215
217
|
end
|
216
218
|
end
|
217
|
-
|
218
|
-
|
data/lib/chef/resource/deploy.rb
CHANGED
@@ -63,6 +63,7 @@ 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???
|
66
67
|
@copy_exclude = []
|
67
68
|
@purge_before_symlink = %w{log tmp/pids public/system}
|
68
69
|
@create_dirs_before_symlink = %w{tmp public config}
|
@@ -78,10 +79,11 @@ class Chef
|
|
78
79
|
@scm_provider = Chef::Provider::Git
|
79
80
|
@svn_force_export = false
|
80
81
|
@allowed_actions.push(:force_deploy, :deploy, :rollback)
|
81
|
-
@additional_remotes =
|
82
|
+
@additional_remotes = {}
|
82
83
|
@keep_releases = 5
|
83
84
|
@enable_checkout = true
|
84
85
|
@checkout_branch = "deploy"
|
86
|
+
@timeout = nil
|
85
87
|
end
|
86
88
|
|
87
89
|
# where the checked out/cloned code goes
|
@@ -104,42 +106,18 @@ class Chef
|
|
104
106
|
end
|
105
107
|
|
106
108
|
# note: deploy_to is your application "meta-root."
|
107
|
-
|
108
|
-
set_or_return(
|
109
|
-
:deploy_to,
|
110
|
-
arg,
|
111
|
-
:kind_of => [ String ]
|
112
|
-
)
|
113
|
-
end
|
109
|
+
attribute :deploy_to, :kind_of => [ String ]
|
114
110
|
|
115
|
-
|
116
|
-
set_or_return(
|
117
|
-
:repo,
|
118
|
-
arg,
|
119
|
-
:kind_of => [ String ]
|
120
|
-
)
|
121
|
-
end
|
111
|
+
attribute :repo, :kind_of => [ String ]
|
122
112
|
alias :repository :repo
|
123
113
|
|
124
|
-
|
125
|
-
set_or_return(
|
126
|
-
:remote,
|
127
|
-
arg,
|
128
|
-
:kind_of => [ String ]
|
129
|
-
)
|
130
|
-
end
|
114
|
+
attribute :remote, :kind_of => [ String ]
|
131
115
|
|
132
|
-
|
133
|
-
set_or_return(
|
134
|
-
:role,
|
135
|
-
arg,
|
136
|
-
:kind_of => [ String ]
|
137
|
-
)
|
138
|
-
end
|
116
|
+
attribute :role, :kind_of => [ String ]
|
139
117
|
|
140
|
-
def restart_command(arg=
|
141
|
-
arg
|
142
|
-
|
118
|
+
def restart_command(arg=NULL_ARG, &block)
|
119
|
+
arg = block if block_given?
|
120
|
+
nillable_set_or_return(
|
143
121
|
:restart_command,
|
144
122
|
arg,
|
145
123
|
:kind_of => [ String, Proc ]
|
@@ -147,155 +125,60 @@ class Chef
|
|
147
125
|
end
|
148
126
|
alias :restart :restart_command
|
149
127
|
|
150
|
-
|
151
|
-
set_or_return(
|
152
|
-
:migrate,
|
153
|
-
arg,
|
154
|
-
:kind_of => [ TrueClass, FalseClass ]
|
155
|
-
)
|
156
|
-
end
|
128
|
+
attribute :migrate, :kind_of => [ TrueClass, FalseClass ]
|
157
129
|
|
158
|
-
|
159
|
-
set_or_return(
|
160
|
-
:migration_command,
|
161
|
-
arg,
|
162
|
-
:kind_of => [ String ]
|
163
|
-
)
|
164
|
-
end
|
130
|
+
attribute :migration_command, kind_of: String
|
165
131
|
|
166
|
-
|
167
|
-
set_or_return(
|
168
|
-
:rollback_on_error,
|
169
|
-
arg,
|
170
|
-
:kind_of => [ TrueClass, FalseClass ]
|
171
|
-
)
|
172
|
-
end
|
132
|
+
attribute :rollback_on_error, :kind_of => [ TrueClass, FalseClass ]
|
173
133
|
|
174
|
-
|
175
|
-
set_or_return(
|
176
|
-
:user,
|
177
|
-
arg,
|
178
|
-
:kind_of => [ String ]
|
179
|
-
)
|
180
|
-
end
|
134
|
+
attribute :user, kind_of: String
|
181
135
|
|
182
|
-
|
183
|
-
set_or_return(
|
184
|
-
:group,
|
185
|
-
arg,
|
186
|
-
:kind_of => [ String ]
|
187
|
-
)
|
188
|
-
end
|
136
|
+
attribute :group, kind_of: [ String ]
|
189
137
|
|
190
|
-
|
191
|
-
set_or_return(
|
192
|
-
:enable_submodules,
|
193
|
-
arg,
|
194
|
-
:kind_of => [ TrueClass, FalseClass ]
|
195
|
-
)
|
196
|
-
end
|
138
|
+
attribute :enable_submodules, kind_of: [ TrueClass, FalseClass ]
|
197
139
|
|
198
|
-
|
199
|
-
set_or_return(
|
200
|
-
:shallow_clone,
|
201
|
-
arg,
|
202
|
-
:kind_of => [ TrueClass, FalseClass ]
|
203
|
-
)
|
204
|
-
end
|
140
|
+
attribute :shallow_clone, kind_of: [ TrueClass, FalseClass ]
|
205
141
|
|
206
|
-
|
207
|
-
set_or_return(
|
208
|
-
:repository_cache,
|
209
|
-
arg,
|
210
|
-
:kind_of => [ String ]
|
211
|
-
)
|
212
|
-
end
|
142
|
+
attribute :repository_cache, kind_of: String
|
213
143
|
|
214
|
-
|
215
|
-
set_or_return(
|
216
|
-
:copy_exclude,
|
217
|
-
arg,
|
218
|
-
:kind_of => [ String ]
|
219
|
-
)
|
220
|
-
end
|
144
|
+
attribute :copy_exclude, kind_of: String
|
221
145
|
|
222
|
-
|
223
|
-
set_or_return(
|
224
|
-
:revision,
|
225
|
-
arg,
|
226
|
-
:kind_of => [ String ]
|
227
|
-
)
|
228
|
-
end
|
146
|
+
attribute :revision, kind_of: String
|
229
147
|
alias :branch :revision
|
230
148
|
|
231
|
-
|
232
|
-
set_or_return(
|
233
|
-
:git_ssh_wrapper,
|
234
|
-
arg,
|
235
|
-
:kind_of => [ String ]
|
236
|
-
)
|
237
|
-
end
|
149
|
+
attribute :git_ssh_wrapper, kind_of: String
|
238
150
|
alias :ssh_wrapper :git_ssh_wrapper
|
239
151
|
|
240
|
-
|
241
|
-
set_or_return(
|
242
|
-
:svn_username,
|
243
|
-
arg,
|
244
|
-
:kind_of => [ String ]
|
245
|
-
)
|
246
|
-
end
|
152
|
+
attribute :svn_username, kind_of: String
|
247
153
|
|
248
|
-
|
249
|
-
set_or_return(
|
250
|
-
:svn_password,
|
251
|
-
arg,
|
252
|
-
:kind_of => [ String ]
|
253
|
-
)
|
254
|
-
end
|
154
|
+
attribute :svn_password, kind_of: String
|
255
155
|
|
256
|
-
|
257
|
-
set_or_return(
|
258
|
-
:svn_arguments,
|
259
|
-
arg,
|
260
|
-
:kind_of => [ String ]
|
261
|
-
)
|
262
|
-
end
|
156
|
+
attribute :svn_arguments, kind_of: String
|
263
157
|
|
264
|
-
|
265
|
-
set_or_return(
|
266
|
-
:svn_arguments,
|
267
|
-
arg,
|
268
|
-
:kind_of => [ String ])
|
269
|
-
end
|
158
|
+
attribute :svn_info_args, kind_of: String
|
270
159
|
|
271
|
-
def scm_provider(arg=
|
160
|
+
def scm_provider(arg=NULL_ARG)
|
272
161
|
klass = if arg.kind_of?(String) || arg.kind_of?(Symbol)
|
273
162
|
lookup_provider_constant(arg)
|
274
163
|
else
|
275
164
|
arg
|
276
165
|
end
|
277
|
-
|
166
|
+
nillable_set_or_return(
|
278
167
|
:scm_provider,
|
279
168
|
klass,
|
280
169
|
:kind_of => [ Class ]
|
281
170
|
)
|
282
171
|
end
|
283
172
|
|
284
|
-
|
285
|
-
set_or_return(
|
286
|
-
:svn_force_export,
|
287
|
-
arg,
|
288
|
-
:kind_of => [ TrueClass, FalseClass ]
|
289
|
-
)
|
290
|
-
end
|
173
|
+
attribute :svn_force_export, kind_of: [ TrueClass, FalseClass ]
|
291
174
|
|
292
|
-
def environment(arg=
|
175
|
+
def environment(arg=NULL_ARG)
|
293
176
|
if arg.is_a?(String)
|
294
177
|
Chef::Log.debug "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'"
|
295
178
|
Chef::Log.warn "[DEPRECATED] please modify your deploy recipe or attributes to set the environment using a hash"
|
296
179
|
arg = {"RAILS_ENV"=>arg,"MERB_ENV"=>arg,"RACK_ENV"=>arg}
|
297
180
|
end
|
298
|
-
|
181
|
+
nillable_set_or_return(
|
299
182
|
:environment,
|
300
183
|
arg,
|
301
184
|
:kind_of => [ Hash ]
|
@@ -303,8 +186,8 @@ class Chef
|
|
303
186
|
end
|
304
187
|
|
305
188
|
# The number of old release directories to keep around after cleanup
|
306
|
-
def keep_releases(arg=
|
307
|
-
[
|
189
|
+
def keep_releases(arg=NULL_ARG)
|
190
|
+
[nillable_set_or_return(
|
308
191
|
:keep_releases,
|
309
192
|
arg,
|
310
193
|
:kind_of => [ Integer ]), 1].max
|
@@ -314,13 +197,7 @@ class Chef
|
|
314
197
|
# SCM clone/checkout before symlinking. Use this to get rid of files and
|
315
198
|
# directories you want to be shared between releases.
|
316
199
|
# Default: ["log", "tmp/pids", "public/system"]
|
317
|
-
|
318
|
-
set_or_return(
|
319
|
-
:purge_before_symlink,
|
320
|
-
arg,
|
321
|
-
:kind_of => Array
|
322
|
-
)
|
323
|
-
end
|
200
|
+
attribute :purge_before_symlink, kind_of: Array
|
324
201
|
|
325
202
|
# An array of paths, relative to your app's root, where you expect dirs to
|
326
203
|
# exist before symlinking. This runs after #purge_before_symlink, so you
|
@@ -330,13 +207,7 @@ class Chef
|
|
330
207
|
# then specify tmp here so that the tmp directory will exist when you
|
331
208
|
# symlink the pids directory in to the current release.
|
332
209
|
# Default: ["tmp", "public", "config"]
|
333
|
-
|
334
|
-
set_or_return(
|
335
|
-
:create_dirs_before_symlink,
|
336
|
-
arg,
|
337
|
-
:kind_of => Array
|
338
|
-
)
|
339
|
-
end
|
210
|
+
attribute :create_dirs_before_symlink, kind_of: Array
|
340
211
|
|
341
212
|
# A Hash of shared/dir/path => release/dir/path. This attribute determines
|
342
213
|
# which files and dirs in the shared directory get symlinked to the current
|
@@ -344,13 +215,7 @@ class Chef
|
|
344
215
|
# $shared/pids that you would like to symlink as $current_release/tmp/pids
|
345
216
|
# you specify it as "pids" => "tmp/pids"
|
346
217
|
# Default {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}
|
347
|
-
|
348
|
-
set_or_return(
|
349
|
-
:symlinks,
|
350
|
-
arg,
|
351
|
-
:kind_of => Hash
|
352
|
-
)
|
353
|
-
end
|
218
|
+
attribute :symlinks, kind_of: Hash
|
354
219
|
|
355
220
|
# A Hash of shared/dir/path => release/dir/path. This attribute determines
|
356
221
|
# which files in the shared directory get symlinked to the current release
|
@@ -359,74 +224,44 @@ class Chef
|
|
359
224
|
# For a rails/merb app, this is used to link in a known good database.yml
|
360
225
|
# (with the production db password) before running migrate.
|
361
226
|
# Default {"config/database.yml" => "config/database.yml"}
|
362
|
-
|
363
|
-
set_or_return(
|
364
|
-
:symlink_before_migrate,
|
365
|
-
arg,
|
366
|
-
:kind_of => Hash
|
367
|
-
)
|
368
|
-
end
|
227
|
+
attribute :symlink_before_migrate, kind_of: Hash
|
369
228
|
|
370
229
|
# Callback fires before migration is run.
|
371
|
-
def before_migrate(arg=
|
372
|
-
arg
|
373
|
-
|
230
|
+
def before_migrate(arg=NULL_ARG, &block)
|
231
|
+
arg = block if block_given?
|
232
|
+
nillable_set_or_return(:before_migrate, arg, kind_of: [Proc, String])
|
374
233
|
end
|
375
234
|
|
376
235
|
# Callback fires before symlinking
|
377
|
-
def before_symlink(arg=
|
378
|
-
arg
|
379
|
-
|
236
|
+
def before_symlink(arg=NULL_ARG, &block)
|
237
|
+
arg = block if block_given?
|
238
|
+
nillable_set_or_return(:before_symlink, arg, kind_of: [Proc, String])
|
380
239
|
end
|
381
240
|
|
382
241
|
# Callback fires before restart
|
383
|
-
def before_restart(arg=
|
384
|
-
arg
|
385
|
-
|
242
|
+
def before_restart(arg=NULL_ARG, &block)
|
243
|
+
arg = block if block_given?
|
244
|
+
nillable_set_or_return(:before_restart, arg, kind_of: [Proc, String])
|
386
245
|
end
|
387
246
|
|
388
247
|
# Callback fires after restart
|
389
|
-
def after_restart(arg=
|
390
|
-
arg
|
391
|
-
|
248
|
+
def after_restart(arg=NULL_ARG, &block)
|
249
|
+
arg = block if block_given?
|
250
|
+
nillable_set_or_return(:after_restart, arg, kind_of: [Proc, String])
|
392
251
|
end
|
393
252
|
|
394
|
-
|
395
|
-
set_or_return(
|
396
|
-
:additional_remotes,
|
397
|
-
arg,
|
398
|
-
:kind_of => Hash
|
399
|
-
)
|
400
|
-
end
|
253
|
+
attribute :additional_remotes, kind_of: Hash
|
401
254
|
|
402
|
-
|
403
|
-
set_or_return(
|
404
|
-
:enable_checkout,
|
405
|
-
arg,
|
406
|
-
:kind_of => [TrueClass, FalseClass]
|
407
|
-
)
|
408
|
-
end
|
255
|
+
attribute :enable_checkout, kind_of: [ TrueClass, FalseClass ]
|
409
256
|
|
410
|
-
|
411
|
-
set_or_return(
|
412
|
-
:checkout_branch,
|
413
|
-
arg,
|
414
|
-
:kind_of => String
|
415
|
-
)
|
416
|
-
end
|
257
|
+
attribute :checkout_branch, kind_of: String
|
417
258
|
|
418
259
|
# FIXME The Deploy resource may be passed to an SCM provider as its
|
419
260
|
# resource. The SCM provider knows that SCM resources can specify a
|
420
261
|
# timeout for SCM operations. The deploy resource must therefore support
|
421
262
|
# a timeout method, but the timeout it describes is for SCM operations,
|
422
263
|
# not the overall deployment. This is potentially confusing.
|
423
|
-
|
424
|
-
set_or_return(
|
425
|
-
:timeout,
|
426
|
-
arg,
|
427
|
-
:kind_of => Integer
|
428
|
-
)
|
429
|
-
end
|
264
|
+
attribute :timeout, kind_of: Integer
|
430
265
|
|
431
266
|
end
|
432
267
|
end
|