chef 14.1.1-universal-mingw32 → 14.1.12-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc96acad4dc81a43b115023d70b2f31627f388f083aa4fd08d8f4def014a7f3
4
- data.tar.gz: f298168e72110095c85dccc6933720c30c63335ecd233bc135ffe63380f440f1
3
+ metadata.gz: b2bd4dff7db3d6974b97656208d26294a91b879c4ac248a1f015ef8ba0e564c3
4
+ data.tar.gz: c521620fdca29be30799f680c071d4ef38e84e302324f14c80fc748ed551e7e9
5
5
  SHA512:
6
- metadata.gz: 94094b42ac4c98c766561ec8f0302155e68ca9fcd1264190d6840b4192a9e2a752d9900c5141d78ab87ae5592b2429e992ff83b8844ac71e819dce3af5b90019
7
- data.tar.gz: d1147c712a59e2a76bb6eaa23f576646e5ab7e0b77fd13f02e8edb1aa6e3ef65e20cbf046911b0a27e6714b4f7d212d6f7bea1b0cd8fa239b77084f76c126c2d
6
+ metadata.gz: 0075f0bf86d6bb18941e1e0f25f5d43b03b42e57c2fae1773088f514fe6d365979dd30bd21925dc5cefc82c02bf06972c58c64150c431af7de72e0f3f2208872
7
+ data.tar.gz: 395cc71f09d88f45f1f11b30d4c3e0c777214c2faeeea44568eebbb681dc597531cef675e20c3498126e385671932f052ffebbfe1836565d0836463e39990b60
data/VERSION CHANGED
@@ -1 +1 @@
1
- 14.1.1
1
+ 14.1.12
@@ -75,7 +75,7 @@ class Chef
75
75
 
76
76
  config_file = File.expand_path(config_file)
77
77
  if File.exist?(config_file)
78
- confirm("Overwrite #{config_file}?")
78
+ confirm("Overwrite #{config_file}")
79
79
  end
80
80
  ::File.open(config_file, "w") do |f|
81
81
  f.puts <<-EOH
@@ -288,8 +288,11 @@ class Chef
288
288
  end
289
289
 
290
290
  # Returns true if this Node expects a given role, false if not.
291
+ #
292
+ # @param role_name [String] Role to check for
293
+ # @return [Boolean]
291
294
  def role?(role_name)
292
- run_list.include?("role[#{role_name}]")
295
+ Array(self[:roles]).include?(role_name)
293
296
  end
294
297
 
295
298
  def primary_runlist
@@ -57,6 +57,8 @@ class Chef
57
57
  action :nothing
58
58
  end
59
59
 
60
+ cleanup_legacy_file!
61
+
60
62
  repo = build_repo(
61
63
  new_resource.uri,
62
64
  new_resource.distribution,
@@ -66,7 +68,7 @@ class Chef
66
68
  new_resource.deb_src
67
69
  )
68
70
 
69
- declare_resource(:file, "/etc/apt/sources.list.d/#{new_resource.name}.list") do
71
+ declare_resource(:file, "/etc/apt/sources.list.d/#{new_resource.repo_name}.list") do
70
72
  owner "root"
71
73
  group "root"
72
74
  mode "0644"
@@ -79,9 +81,10 @@ class Chef
79
81
  end
80
82
 
81
83
  action :remove do
82
- if ::File.exist?("/etc/apt/sources.list.d/#{new_resource.name}.list")
83
- converge_by "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/" do
84
- declare_resource(:file, "/etc/apt/sources.list.d/#{new_resource.name}.list") do
84
+ cleanup_legacy_file!
85
+ if ::File.exist?("/etc/apt/sources.list.d/#{new_resource.repo_name}.list")
86
+ converge_by "Removing #{new_resource.repo_name} repository from /etc/apt/sources.list.d/" do
87
+ declare_resource(:file, "/etc/apt/sources.list.d/#{new_resource.repo_name}.list") do
85
88
  sensitive new_resource.sensitive
86
89
  action :delete
87
90
  notifies :update, "apt_update[#{new_resource.name}]", :immediately if new_resource.cache_rebuild
@@ -93,7 +96,7 @@ class Chef
93
96
  end
94
97
  end
95
98
  else
96
- logger.trace("/etc/apt/sources.list.d/#{new_resource.name}.list does not exist. Nothing to do")
99
+ logger.trace("/etc/apt/sources.list.d/#{new_resource.repo_name}.list does not exist. Nothing to do")
97
100
  end
98
101
  end
99
102
 
@@ -325,6 +328,23 @@ class Chef
325
328
  repo << "deb-src #{info}\n" if add_src
326
329
  repo
327
330
  end
331
+
332
+ # clean up a potentially legacy file from before we fixed the usage of
333
+ # new_resource.name vs. new_resource.repo_name. We might have the
334
+ # name.list file hanging around and need to clean it up.
335
+ #
336
+ # @return [void]
337
+ def cleanup_legacy_file!
338
+ legacy_path = "/etc/apt/sources.list.d/#{new_resource.name}.list"
339
+ if new_resource.name != new_resource.repo_name && ::File.exist?(legacy_path)
340
+ converge_by "Cleaning up legacy #{legacy_path} repo file" do
341
+ declare_resource(:file, legacy_path) do
342
+ action :delete
343
+ # Not triggering an update since it isn't super likely to be needed.
344
+ end
345
+ end
346
+ end
347
+ end
328
348
  end
329
349
  end
330
350
  end
@@ -195,7 +195,7 @@ class Chef
195
195
  # since we're in a local branch already, just reset to specified revision rather than merge
196
196
  logger.trace "Fetching updates from #{new_resource.remote} and resetting to revision #{target_revision}"
197
197
  git("fetch", "--prune", new_resource.remote, cwd: cwd)
198
- git("fetch", "--prune-tags", new_resource.remote, "--tags", cwd: cwd)
198
+ git("fetch", new_resource.remote, "--tags", cwd: cwd)
199
199
  git("reset", "--hard", target_revision, cwd: cwd)
200
200
  end
201
201
  end
@@ -114,6 +114,9 @@ class Chef
114
114
  end
115
115
 
116
116
  def action_create
117
+ if new_resource.command && new_resource.command.split.size > 1
118
+ set_command_and_arguments
119
+ end
117
120
  if current_resource.exists
118
121
  logger.trace "#{new_resource} task exist."
119
122
  unless (task_needs_update?(current_resource.task)) || (new_resource.force)
@@ -136,6 +139,7 @@ class Chef
136
139
  task.new_work_item(new_resource.task_name, trigger)
137
140
  end
138
141
  task.application_name = new_resource.command
142
+ task.parameters = new_resource.command_arguments if new_resource.command_arguments
139
143
  task.working_directory = new_resource.cwd if new_resource.cwd
140
144
  task.configure_settings(config_settings)
141
145
  task.configure_principals(principal_settings)
@@ -225,6 +229,13 @@ class Chef
225
229
 
226
230
  private
227
231
 
232
+ # seprated command arguments from :command property
233
+ def set_command_and_arguments
234
+ cmd, *args = Shellwords.split(new_resource.command)
235
+ new_resource.command = cmd
236
+ new_resource.command_arguments = args.join(" ")
237
+ end
238
+
228
239
  def set_start_day_and_time
229
240
  new_resource.start_day = Time.now.strftime("%m/%d/%Y") unless new_resource.start_day
230
241
  new_resource.start_time = Time.now.strftime("%H:%M") unless new_resource.start_time
@@ -234,6 +245,7 @@ class Chef
234
245
  converge_by("#{new_resource} task updated") do
235
246
  task.set_account_information(new_resource.user, new_resource.password)
236
247
  task.application_name = new_resource.command if new_resource.command
248
+ task.parameters = new_resource.command_arguments if new_resource.command_arguments
237
249
  task.working_directory = new_resource.cwd if new_resource.cwd
238
250
  task.trigger = trigger unless new_resource.frequency == :none
239
251
  task.configure_settings(config_settings)
@@ -315,6 +327,7 @@ class Chef
315
327
  if new_resource.frequency == :none
316
328
  flag = (task.account_information != new_resource.user ||
317
329
  task.application_name != new_resource.command ||
330
+ task.parameters != new_resource.command_arguments.to_s ||
318
331
  task.principals[:run_level] != run_level)
319
332
  else
320
333
  current_task_trigger = task.trigger(0)
@@ -334,6 +347,7 @@ class Chef
334
347
  current_task_trigger[:minutes_interval].to_i != new_task_trigger[:minutes_interval].to_i ||
335
348
  task.account_information != new_resource.user ||
336
349
  task.application_name != new_resource.command ||
350
+ task.parameters != new_resource.command_arguments.to_s ||
337
351
  task.working_directory != new_resource.cwd.to_s ||
338
352
  task.principals[:logon_type] != logon_type ||
339
353
  task.principals[:run_level] != run_level
@@ -56,7 +56,7 @@ class Chef
56
56
  property :source, String, default: lazy { ::File.basename(path) }
57
57
  property :files_backup, [ Integer, FalseClass ], default: 5, desired_state: false
58
58
  property :purge, [ TrueClass, FalseClass ], default: false, desired_state: false
59
- property :overwrite, [ TrueClass, FalseClass ], default: false
59
+ property :overwrite, [ TrueClass, FalseClass ], default: true
60
60
  property :cookbook, String
61
61
 
62
62
  def files_group(arg = nil)
@@ -34,20 +34,20 @@ class Chef
34
34
  action :enable do
35
35
  description "Enable a RHSM repository"
36
36
 
37
- execute "Enable repository #{repo_name}" do
38
- command "subscription-manager repos --enable=#{repo_name}"
37
+ execute "Enable repository #{new_resource.repo_name}" do
38
+ command "subscription-manager repos --enable=#{new_resource.repo_name}"
39
39
  action :run
40
- not_if { repo_enabled?(repo_name) }
40
+ not_if { repo_enabled?(new_resource.repo_name) }
41
41
  end
42
42
  end
43
43
 
44
44
  action :disable do
45
45
  description "Disable a RHSM repository"
46
46
 
47
- execute "Enable repository #{repo_name}" do
48
- command "subscription-manager repos --disable=#{repo_name}"
47
+ execute "Enable repository #{new_resource.repo_name}" do
48
+ command "subscription-manager repos --disable=#{new_resource.repo_name}"
49
49
  action :run
50
- only_if { repo_enabled?(repo_name) }
50
+ only_if { repo_enabled?(new_resource.repo_name) }
51
51
  end
52
52
  end
53
53
 
@@ -60,7 +60,7 @@ class Chef
60
60
  property :minutes_duration, [String, Integer]
61
61
  property :minutes_interval, [String, Integer]
62
62
 
63
- attr_accessor :exists, :task
63
+ attr_accessor :exists, :task, :command_arguments
64
64
 
65
65
  SYSTEM_USERS = ['NT AUTHORITY\SYSTEM', "SYSTEM", 'NT AUTHORITY\LOCALSERVICE', 'NT AUTHORITY\NETWORKSERVICE', 'BUILTIN\USERS', "USERS"].freeze
66
66
  VALID_WEEK_DAYS = %w{ mon tue wed thu fri sat sun * }
@@ -23,7 +23,7 @@ require "chef/version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("14.1.1")
26
+ VERSION = Chef::VersionString.new("14.1.12")
27
27
  end
28
28
 
29
29
  #
@@ -20,7 +20,8 @@ require "spec_helper"
20
20
  require "chef/provider/windows_task"
21
21
 
22
22
  describe Chef::Resource::WindowsTask, :windows_only do
23
- let(:task_name) { "chef-client" }
23
+ # resource.task.application_name will default to task_name unless resource.command is set
24
+ let(:task_name) { "chef-client-functional-test" }
24
25
  let(:new_resource) { Chef::Resource::WindowsTask.new(task_name) }
25
26
  let(:windows_task_provider) do
26
27
  node = Chef::Node.new
@@ -31,6 +32,90 @@ describe Chef::Resource::WindowsTask, :windows_only do
31
32
 
32
33
  describe "action :create" do
33
34
  after { delete_task }
35
+ context "when command is with arguments" do
36
+ subject do
37
+ new_resource = Chef::Resource::WindowsTask.new(task_name, run_context)
38
+ new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this
39
+ # Make sure MM/DD/YYYY is accepted
40
+
41
+ new_resource.start_day "09/20/2017"
42
+ new_resource.frequency :hourly
43
+ new_resource
44
+ end
45
+
46
+ it "creates scheduled task and sets command arguments" do
47
+ subject.command "chef-client -W"
48
+ call_for_create_action
49
+ #loading current resource again to check new task is creted and it matches task parameters
50
+ current_resource = call_for_load_current_resource
51
+ expect(current_resource.exists).to eq(true)
52
+ expect(current_resource.task.application_name).to eq("chef-client")
53
+ expect(current_resource.task.parameters).to eq("-W")
54
+ end
55
+
56
+ it "does not converge the resource if it is already converged" do
57
+ subject.command "chef-client -W"
58
+ subject.run_action(:create)
59
+ subject.command "chef-client -W"
60
+ subject.run_action(:create)
61
+ expect(subject).not_to be_updated_by_last_action
62
+ end
63
+
64
+ it "creates scheduled task and sets command arguments" do
65
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
66
+ call_for_create_action
67
+ #loading current resource again to check new task is creted and it matches task parameters
68
+ current_resource = call_for_load_current_resource
69
+ expect(current_resource.exists).to eq(true)
70
+ expect(current_resource.task.application_name).to eq("chef-client")
71
+ expect(current_resource.task.parameters).to eq("-W -L C:\\chef\\chef-ad-join.log")
72
+ end
73
+
74
+ it "does not converge the resource if it is already converged" do
75
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
76
+ subject.run_action(:create)
77
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
78
+ subject.run_action(:create)
79
+ expect(subject).not_to be_updated_by_last_action
80
+ end
81
+
82
+ it "creates scheduled task and sets command arguments" do
83
+ subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2'
84
+ call_for_create_action
85
+ #loading current resource again to check new task is creted and it matches task parameters
86
+ current_resource = call_for_load_current_resource
87
+ expect(current_resource.exists).to eq(true)
88
+ expect(current_resource.task.application_name).to eq("C:\\Program Files\\example\\program.exe")
89
+ expect(current_resource.task.parameters).to eq("-arg1 --arg2")
90
+ end
91
+
92
+ it "does not converge the resource if it is already converged" do
93
+ subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2'
94
+ subject.run_action(:create)
95
+ subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2'
96
+ subject.run_action(:create)
97
+ expect(subject).not_to be_updated_by_last_action
98
+ end
99
+
100
+ it "creates scheduled task and sets command arguments" do
101
+ subject.command "ping http://www.google.com"
102
+ call_for_create_action
103
+ #loading current resource again to check new task is creted and it matches task parameters
104
+ current_resource = call_for_load_current_resource
105
+ expect(current_resource.exists).to eq(true)
106
+ expect(current_resource.task.application_name).to eq("ping")
107
+ expect(current_resource.task.parameters).to eq("http://www.google.com")
108
+ end
109
+
110
+ it "does not converge the resource if it is already converged" do
111
+ subject.command "ping http://www.google.com"
112
+ subject.run_action(:create)
113
+ subject.command "ping http://www.google.com"
114
+ subject.run_action(:create)
115
+ expect(subject).not_to be_updated_by_last_action
116
+ end
117
+ end
118
+
34
119
  context "when frequency_modifier are not passed" do
35
120
  subject do
36
121
  new_resource = Chef::Resource::WindowsTask.new(task_name, run_context)
@@ -47,7 +132,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
47
132
  #loading current resource again to check new task is creted and it matches task parameters
48
133
  current_resource = call_for_load_current_resource
49
134
  expect(current_resource.exists).to eq(true)
50
- expect(current_resource.task.application_name).to eq("chef-client")
135
+ expect(current_resource.task.application_name).to eq(task_name)
51
136
  trigger_details = current_resource.task.trigger(0)
52
137
  expect(trigger_details[:start_year]).to eq("2017")
53
138
  expect(trigger_details[:start_month]).to eq("09")
@@ -80,7 +165,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
80
165
  current_resource = call_for_load_current_resource
81
166
  expect(current_resource.exists).to eq(true)
82
167
  trigger_details = current_resource.task.trigger(0)
83
- expect(current_resource.task.application_name).to eq("chef-client")
168
+ expect(current_resource.task.application_name).to eq(task_name)
84
169
  expect(trigger_details[:minutes_interval]).to eq(15)
85
170
  expect(trigger_details[:trigger_type]).to eq(1)
86
171
  expect(current_resource.task.principals[:run_level]).to eq(1)
@@ -104,7 +189,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
104
189
  current_resource = call_for_load_current_resource
105
190
  expect(current_resource.exists).to eq(true)
106
191
  trigger_details = current_resource.task.trigger(0)
107
- expect(current_resource.task.application_name).to eq("chef-client")
192
+ expect(current_resource.task.application_name).to eq(task_name)
108
193
  expect(trigger_details[:minutes_interval]).to eq(20)
109
194
  expect(trigger_details[:trigger_type]).to eq(1)
110
195
  expect(current_resource.task.principals[:run_level]).to eq(1)
@@ -128,7 +213,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
128
213
  current_resource = call_for_load_current_resource
129
214
  expect(current_resource.exists).to eq(true)
130
215
  trigger_details = current_resource.task.trigger(0)
131
- expect(current_resource.task.application_name).to eq("chef-client")
216
+ expect(current_resource.task.application_name).to eq(task_name)
132
217
  expect(trigger_details[:minutes_interval]).to eq(180)
133
218
  expect(trigger_details[:trigger_type]).to eq(1)
134
219
  end
@@ -151,7 +236,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
151
236
  current_resource = call_for_load_current_resource
152
237
  expect(current_resource.exists).to eq(true)
153
238
  trigger_details = current_resource.task.trigger(0)
154
- expect(current_resource.task.application_name).to eq("chef-client")
239
+ expect(current_resource.task.application_name).to eq(task_name)
155
240
  expect(trigger_details[:minutes_interval]).to eq(300)
156
241
  expect(trigger_details[:trigger_type]).to eq(1)
157
242
  end
@@ -173,7 +258,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
173
258
  current_resource = call_for_load_current_resource
174
259
  expect(current_resource.exists).to eq(true)
175
260
  trigger_details = current_resource.task.trigger(0)
176
- expect(current_resource.task.application_name).to eq("chef-client")
261
+ expect(current_resource.task.application_name).to eq(task_name)
177
262
  expect(trigger_details[:trigger_type]).to eq(2)
178
263
  expect(current_resource.task.principals[:run_level]).to eq(1)
179
264
  expect(trigger_details[:type][:days_interval]).to eq(1)
@@ -208,7 +293,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
208
293
  current_resource = call_for_load_current_resource
209
294
  expect(current_resource.exists).to eq(true)
210
295
  trigger_details = current_resource.task.trigger(0)
211
- expect(current_resource.task.application_name).to eq("chef-client")
296
+ expect(current_resource.task.application_name).to eq(task_name)
212
297
  expect(trigger_details[:trigger_type]).to eq(4)
213
298
  expect(current_resource.task.principals[:run_level]).to eq(1)
214
299
  expect(trigger_details[:type][:days]).to eq(1)
@@ -228,7 +313,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
228
313
  current_resource = call_for_load_current_resource
229
314
  expect(current_resource.exists).to eq(true)
230
315
  trigger_details = current_resource.task.trigger(0)
231
- expect(current_resource.task.application_name).to eq("chef-client")
316
+ expect(current_resource.task.application_name).to eq(task_name)
232
317
  expect(trigger_details[:trigger_type]).to eq(4)
233
318
  expect(current_resource.task.principals[:run_level]).to eq(1)
234
319
  expect(trigger_details[:type][:days]).to eq(7)
@@ -249,7 +334,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
249
334
  current_resource = call_for_load_current_resource
250
335
  expect(current_resource.exists).to eq(true)
251
336
  trigger_details = current_resource.task.trigger(0)
252
- expect(current_resource.task.application_name).to eq("chef-client")
337
+ expect(current_resource.task.application_name).to eq(task_name)
253
338
  expect(trigger_details[:trigger_type]).to eq(4)
254
339
  expect(current_resource.task.principals[:run_level]).to eq(1)
255
340
  expect(trigger_details[:type][:days]).to eq(1209548943) #TODO:: windows_task_provider.send(:days_of_month)
@@ -271,7 +356,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
271
356
  current_resource = call_for_load_current_resource
272
357
  expect(current_resource.exists).to eq(true)
273
358
  trigger_details = current_resource.task.trigger(0)
274
- expect(current_resource.task.application_name).to eq("chef-client")
359
+ expect(current_resource.task.application_name).to eq(task_name)
275
360
  expect(trigger_details[:trigger_type]).to eq(4)
276
361
  expect(current_resource.task.principals[:run_level]).to eq(1)
277
362
  expect(trigger_details[:type][:days]).to eq(538443919) #TODO:windows_task_provider.send(:days_of_month)
@@ -294,7 +379,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
294
379
  current_resource = call_for_load_current_resource
295
380
  expect(current_resource.exists).to eq(true)
296
381
  trigger_details = current_resource.task.trigger(0)
297
- expect(current_resource.task.application_name).to eq("chef-client")
382
+ expect(current_resource.task.application_name).to eq(task_name)
298
383
  expect(trigger_details[:trigger_type]).to eq(5)
299
384
  expect(current_resource.task.principals[:run_level]).to eq(1)
300
385
  expect(trigger_details[:type][:days_of_week]).to eq(35)
@@ -362,7 +447,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
362
447
  current_resource = call_for_load_current_resource
363
448
  expect(current_resource.exists).to eq(true)
364
449
  trigger_details = current_resource.task.trigger(0)
365
- expect(current_resource.task.application_name).to eq("chef-client")
450
+ expect(current_resource.task.application_name).to eq(task_name)
366
451
  expect(trigger_details[:trigger_type]).to eq(5)
367
452
  expect(trigger_details[:type][:months]).to eq(4095)
368
453
  expect(trigger_details[:type][:weeks_of_month]).to eq(7)
@@ -385,7 +470,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
385
470
  current_resource = call_for_load_current_resource
386
471
  expect(current_resource.exists).to eq(true)
387
472
  trigger_details = current_resource.task.trigger(0)
388
- expect(current_resource.task.application_name).to eq("chef-client")
473
+ expect(current_resource.task.application_name).to eq(task_name)
389
474
  expect(trigger_details[:trigger_type]).to eq(4)
390
475
  expect(trigger_details[:type][:months]).to eq(2080)
391
476
  expect(trigger_details[:type][:days]).to eq(3)
@@ -417,7 +502,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
417
502
  current_resource = call_for_load_current_resource
418
503
  expect(current_resource.exists).to eq(true)
419
504
  trigger_details = current_resource.task.trigger(0)
420
- expect(current_resource.task.application_name).to eq("chef-client")
505
+ expect(current_resource.task.application_name).to eq(task_name)
421
506
  expect(trigger_details[:trigger_type]).to eq(4)
422
507
  expect(trigger_details[:type][:months]).to eq(4095)
423
508
  expect(trigger_details[:type][:days]).to eq(0)
@@ -438,7 +523,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
438
523
  current_resource = call_for_load_current_resource
439
524
  expect(current_resource.exists).to eq(true)
440
525
  trigger_details = current_resource.task.trigger(0)
441
- expect(current_resource.task.application_name).to eq("chef-client")
526
+ expect(current_resource.task.application_name).to eq(task_name)
442
527
  expect(trigger_details[:trigger_type]).to eq(4)
443
528
  expect(trigger_details[:type][:months]).to eq(4095)
444
529
  expect(trigger_details[:type][:days]).to eq(0)
@@ -462,7 +547,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
462
547
  current_resource = call_for_load_current_resource
463
548
  expect(current_resource.exists).to eq(true)
464
549
  trigger_details = current_resource.task.trigger(0)
465
- expect(current_resource.task.application_name).to eq("chef-client")
550
+ expect(current_resource.task.application_name).to eq(task_name)
466
551
  expect(trigger_details[:trigger_type]).to eq(5)
467
552
  expect(trigger_details[:type][:months]).to eq(4095)
468
553
  expect(trigger_details[:type][:days_of_week]).to eq(34)
@@ -486,7 +571,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
486
571
  current_resource = call_for_load_current_resource
487
572
  expect(current_resource.exists).to eq(true)
488
573
  trigger_details = current_resource.task.trigger(0)
489
- expect(current_resource.task.application_name).to eq("chef-client")
574
+ expect(current_resource.task.application_name).to eq(task_name)
490
575
  expect(trigger_details[:trigger_type]).to eq(4)
491
576
  expect(trigger_details[:type][:months]).to eq(4095)
492
577
  expect(trigger_details[:type][:days]).to eq(1)
@@ -525,7 +610,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
525
610
  current_resource = call_for_load_current_resource
526
611
  expect(current_resource.exists).to eq(true)
527
612
  trigger_details = current_resource.task.trigger(0)
528
- expect(current_resource.task.application_name).to eq("chef-client")
613
+ expect(current_resource.task.application_name).to eq(task_name)
529
614
  expect(trigger_details[:trigger_type]).to eq(4)
530
615
  expect(current_resource.task.principals[:run_level]).to eq(1)
531
616
  expect(trigger_details[:type][:days]).to eq(2)
@@ -547,7 +632,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
547
632
  current_resource = call_for_load_current_resource
548
633
  expect(current_resource.exists).to eq(true)
549
634
  trigger_details = current_resource.task.trigger(0)
550
- expect(current_resource.task.application_name).to eq("chef-client")
635
+ expect(current_resource.task.application_name).to eq(task_name)
551
636
  expect(trigger_details[:trigger_type]).to eq(4)
552
637
  expect(current_resource.task.principals[:run_level]).to eq(1)
553
638
  expect(trigger_details[:type][:days]).to eq(7)
@@ -568,7 +653,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
568
653
  current_resource = call_for_load_current_resource
569
654
  expect(current_resource.exists).to eq(true)
570
655
  trigger_details = current_resource.task.trigger(0)
571
- expect(current_resource.task.application_name).to eq("chef-client")
656
+ expect(current_resource.task.application_name).to eq(task_name)
572
657
  expect(trigger_details[:trigger_type]).to eq(4)
573
658
  expect(current_resource.task.principals[:run_level]).to eq(1)
574
659
  expect(trigger_details[:type][:days]).to eq(1)
@@ -591,7 +676,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
591
676
  expect(current_resource.exists).to eq(true)
592
677
  trigger_details = current_resource.task.trigger(0)
593
678
  #loading current resource
594
- expect(current_resource.task.application_name).to eq("chef-client")
679
+ expect(current_resource.task.application_name).to eq(task_name)
595
680
  expect(trigger_details[:trigger_type]).to eq(4)
596
681
  expect(current_resource.task.principals[:run_level]).to eq(1)
597
682
  expect(trigger_details[:type][:days]).to eq(1)
@@ -633,7 +718,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
633
718
  current_resource = call_for_load_current_resource
634
719
  expect(current_resource.exists).to eq(true)
635
720
  trigger_details = current_resource.task.trigger(0)
636
- expect(current_resource.task.application_name).to eq("chef-client")
721
+ expect(current_resource.task.application_name).to eq(task_name)
637
722
  expect(trigger_details[:trigger_type]).to eq(1)
638
723
  expect(current_resource.task.principals[:run_level]).to eq(1)
639
724
  expect("#{trigger_details[:start_hour]}:#{trigger_details[:start_minute]}" ).to eq(subject.start_time)
@@ -664,7 +749,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
664
749
  current_resource = call_for_load_current_resource
665
750
  expect(current_resource.exists).to eq(true)
666
751
  trigger_details = current_resource.task.trigger(0)
667
- expect(current_resource.task.application_name).to eq("chef-client")
752
+ expect(current_resource.task.application_name).to eq(task_name)
668
753
  expect(current_resource.task.principals[:run_level]).to eq(1)
669
754
  expect(trigger_details[:trigger_type]).to eq(3)
670
755
  expect(trigger_details[:type][:weeks_interval]).to eq(1)
@@ -684,7 +769,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
684
769
  current_resource = call_for_load_current_resource
685
770
  expect(current_resource.exists).to eq(true)
686
771
  trigger_details = current_resource.task.trigger(0)
687
- expect(current_resource.task.application_name).to eq("chef-client")
772
+ expect(current_resource.task.application_name).to eq(task_name)
688
773
  expect(current_resource.task.principals[:run_level]).to eq(1)
689
774
  expect(trigger_details[:trigger_type]).to eq(3)
690
775
  expect(trigger_details[:type][:weeks_interval]).to eq(1)
@@ -708,7 +793,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
708
793
  current_resource = call_for_load_current_resource
709
794
  expect(current_resource.exists).to eq(true)
710
795
  trigger_details = current_resource.task.trigger(0)
711
- expect(current_resource.task.application_name).to eq("chef-client")
796
+ expect(current_resource.task.application_name).to eq(task_name)
712
797
  expect(current_resource.task.principals[:run_level]).to eq(1)
713
798
  expect(trigger_details[:trigger_type]).to eq(3)
714
799
  expect(trigger_details[:type][:weeks_interval]).to eq(2)
@@ -731,7 +816,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
731
816
  current_resource = call_for_load_current_resource
732
817
  expect(current_resource.exists).to eq(true)
733
818
  trigger_details = current_resource.task.trigger(0)
734
- expect(current_resource.task.application_name).to eq("chef-client")
819
+ expect(current_resource.task.application_name).to eq(task_name)
735
820
  expect(current_resource.task.principals[:run_level]).to eq(1)
736
821
  expect(trigger_details[:trigger_type]).to eq(3)
737
822
  expect(trigger_details[:type][:weeks_interval]).to eq(3)
@@ -788,7 +873,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
788
873
  current_resource = call_for_load_current_resource
789
874
  expect(current_resource.exists).to eq(true)
790
875
  trigger_details = current_resource.task.trigger(0)
791
- expect(current_resource.task.application_name).to eq("chef-client")
876
+ expect(current_resource.task.application_name).to eq(task_name)
792
877
  expect(current_resource.task.principals[:run_level]).to eq(1)
793
878
  expect(trigger_details[:trigger_type]).to eq(3)
794
879
  expect(trigger_details[:type][:weeks_interval]).to eq(1)
@@ -813,7 +898,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
813
898
  current_resource = call_for_load_current_resource
814
899
  expect(current_resource.exists).to eq(true)
815
900
  trigger_details = current_resource.task.trigger(0)
816
- expect(current_resource.task.application_name).to eq("chef-client")
901
+ expect(current_resource.task.application_name).to eq(task_name)
817
902
  expect(current_resource.task.principals[:run_level]).to eq(1)
818
903
  expect(trigger_details[:trigger_type]).to eq(8)
819
904
  end
@@ -833,7 +918,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
833
918
  current_resource = call_for_load_current_resource
834
919
  expect(current_resource.exists).to eq(true)
835
920
  trigger_details = current_resource.task.trigger(0)
836
- expect(current_resource.task.application_name).to eq("chef-client")
921
+ expect(current_resource.task.application_name).to eq(task_name)
837
922
  expect(trigger_details[:trigger_type]).to eq(8)
838
923
  expect(trigger_details[:start_year]).to eq("2018")
839
924
  expect(trigger_details[:start_month]).to eq("09")
@@ -860,7 +945,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
860
945
  current_resource = call_for_load_current_resource
861
946
  expect(current_resource.exists).to eq(true)
862
947
  trigger_details = current_resource.task.trigger(0)
863
- expect(current_resource.task.application_name).to eq("chef-client")
948
+ expect(current_resource.task.application_name).to eq(task_name)
864
949
  expect(current_resource.task.principals[:run_level]).to eq(1)
865
950
  expect(trigger_details[:trigger_type]).to eq(9)
866
951
  end
@@ -880,7 +965,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
880
965
  current_resource = call_for_load_current_resource
881
966
  expect(current_resource.exists).to eq(true)
882
967
  trigger_details = current_resource.task.trigger(0)
883
- expect(current_resource.task.application_name).to eq("chef-client")
968
+ expect(current_resource.task.application_name).to eq(task_name)
884
969
  expect(trigger_details[:trigger_type]).to eq(9)
885
970
  expect(trigger_details[:start_year]).to eq("2018")
886
971
  expect(trigger_details[:start_month]).to eq("09")
@@ -915,7 +1000,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
915
1000
  current_resource = call_for_load_current_resource
916
1001
  expect(current_resource.exists).to eq(true)
917
1002
  trigger_details = current_resource.task.trigger(0)
918
- expect(current_resource.task.application_name).to eq("chef-client")
1003
+ expect(current_resource.task.application_name).to eq(task_name)
919
1004
  expect(current_resource.task.principals[:run_level]).to eq(1)
920
1005
  expect(trigger_details[:trigger_type]).to eq(6)
921
1006
  expect(current_resource.task.settings[:idle_settings][:idle_duration]).to eq("PT20M")
@@ -940,7 +1025,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
940
1025
  current_resource = call_for_load_current_resource
941
1026
  expect(current_resource.exists).to eq(true)
942
1027
  trigger_details = current_resource.task.trigger(0)
943
- expect(current_resource.task.application_name).to eq("chef-client")
1028
+ expect(current_resource.task.application_name).to eq(task_name)
944
1029
  expect(trigger_details[:trigger_type]).to eq(6)
945
1030
  expect(trigger_details[:start_year]).to eq("2018")
946
1031
  expect(trigger_details[:start_month]).to eq("09")
@@ -968,7 +1053,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
968
1053
  current_resource = call_for_load_current_resource
969
1054
  expect(current_resource.exists).to eq(true)
970
1055
  trigger_details = current_resource.task.trigger(0)
971
- expect(current_resource.task.application_name).to eq("chef-client")
1056
+ expect(current_resource.task.application_name).to eq(task_name)
972
1057
  expect(current_resource.task.principals[:run_level]).to eq(1)
973
1058
  expect(trigger_details[:trigger_type]).to eq(1)
974
1059
  expect(trigger_details[:random_minutes_interval]).to eq(20)
@@ -1011,7 +1096,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
1011
1096
  current_resource = call_for_load_current_resource
1012
1097
  expect(current_resource.exists).to eq(true)
1013
1098
 
1014
- expect(current_resource.task.application_name).to eq("chef-client")
1099
+ expect(current_resource.task.application_name).to eq(task_name)
1015
1100
  expect(current_resource.task.principals[:run_level]).to eq(1)
1016
1101
  expect(current_resource.task.trigger_count).to eq(0)
1017
1102
  end
@@ -1380,6 +1465,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
1380
1465
  end
1381
1466
 
1382
1467
  describe "action :enable" do
1468
+ let(:task_name) { "chef-client-functional-test-enable" }
1383
1469
  after { delete_task }
1384
1470
 
1385
1471
  subject do
@@ -1402,6 +1488,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
1402
1488
  end
1403
1489
 
1404
1490
  describe "action :disable" do
1491
+ let(:task_name) { "chef-client-functional-test-disable" }
1405
1492
  after { delete_task }
1406
1493
 
1407
1494
  subject do
@@ -1160,16 +1160,16 @@ describe Chef::Node do
1160
1160
 
1161
1161
  describe "roles" do
1162
1162
  it "should allow you to query whether or not it has a recipe applied with role?" do
1163
- node.run_list << "role[sunrise]"
1163
+ node.automatic["roles"] = %w{sunrise}
1164
1164
  expect(node.role?("sunrise")).to eql(true)
1165
1165
  expect(node.role?("not at home")).to eql(false)
1166
1166
  end
1167
1167
 
1168
1168
  it "should allow you to set roles with arguments" do
1169
- node.run_list << "role[one]"
1170
- node.run_list << "role[two]"
1169
+ node.automatic["roles"] = %w{one two}
1171
1170
  expect(node.role?("one")).to eql(true)
1172
1171
  expect(node.role?("two")).to eql(true)
1172
+ expect(node.role?("three")).to eql(false)
1173
1173
  end
1174
1174
  end
1175
1175
 
@@ -427,7 +427,7 @@ SHAS
427
427
  expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
428
428
  expected_cmd1 = "git fetch --prune origin"
429
429
  expect(@provider).to receive(:shell_out!).with(expected_cmd1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
430
- expected_cmd2 = "git fetch --prune-tags origin --tags"
430
+ expected_cmd2 = "git fetch origin --tags"
431
431
  expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
432
432
  expected_cmd3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
433
433
  expect(@provider).to receive(:shell_out!).with(expected_cmd3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
@@ -445,7 +445,7 @@ SHAS
445
445
  :user => "whois", :group => "thisis",
446
446
  :log_tag => "git[web2.0 app]",
447
447
  :environment => { "HOME" => "/home/whois" })
448
- expected_cmd2 = "git fetch --prune-tags origin --tags"
448
+ expected_cmd2 = "git fetch origin --tags"
449
449
  expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir",
450
450
  :user => "whois", :group => "thisis",
451
451
  :log_tag => "git[web2.0 app]",
@@ -463,7 +463,7 @@ SHAS
463
463
  expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
464
464
  fetch_command1 = "git fetch --prune origin"
465
465
  expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
466
- fetch_command2 = "git fetch --prune-tags origin --tags"
466
+ fetch_command2 = "git fetch origin --tags"
467
467
  expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
468
468
  fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
469
469
  expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
@@ -475,7 +475,7 @@ SHAS
475
475
  expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
476
476
  fetch_command1 = "git fetch --prune opscode"
477
477
  expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
478
- fetch_command2 = "git fetch --prune-tags opscode --tags"
478
+ fetch_command2 = "git fetch opscode --tags"
479
479
  expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
480
480
  fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
481
481
  expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
@@ -35,6 +35,15 @@ describe Chef::Provider::WindowsTask, :windows_only do
35
35
  end
36
36
  end
37
37
 
38
+ describe "#set_command_and_arguments" do
39
+ it "sets the command arguments if command has arguments passed in it" do
40
+ new_resource.command = "chef-client -W"
41
+ provider.send(:set_command_and_arguments)
42
+ expect(new_resource.command).to eq("chef-client")
43
+ expect(new_resource.command_arguments).to eq("-W")
44
+ end
45
+ end
46
+
38
47
  describe "#set_start_day_and_time" do
39
48
  it "sets the curret date and time start_day and start_time if nothing is provided by user" do
40
49
  new_resource.start_day = nil
@@ -67,6 +67,10 @@ describe Chef::Resource::RemoteDirectory do
67
67
  expect(resource.files_owner).to eql(1000)
68
68
  end
69
69
 
70
+ it "overwrites by default" do
71
+ expect(resource.overwrite).to be true
72
+ end
73
+
70
74
  describe "when it has cookbook, files owner, files mode, and source" do
71
75
  before do
72
76
  resource.path("/var/path/")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.1.1
4
+ version: 14.1.12
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 14.1.1
19
+ version: 14.1.12
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 14.1.1
26
+ version: 14.1.12
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement