chef 13.1.31 → 13.2.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -134
  3. data/Rakefile +1 -0
  4. data/VERSION +1 -1
  5. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +1 -0
  6. data/acceptance/top-cookbooks/.kitchen.docker.yml +4 -0
  7. data/lib/chef/application/client.rb +27 -18
  8. data/lib/chef/deprecated.rb +10 -0
  9. data/lib/chef/dsl/declare_resource.rb +9 -1
  10. data/lib/chef/knife.rb +5 -1
  11. data/lib/chef/knife/cookbook_test.rb +1 -1
  12. data/lib/chef/policy_builder/policyfile.rb +27 -1
  13. data/lib/chef/provider.rb +2 -2
  14. data/lib/chef/provider/group/aix.rb +1 -1
  15. data/lib/chef/provider/group/groupadd.rb +1 -1
  16. data/lib/chef/provider/package/chocolatey.rb +1 -1
  17. data/lib/chef/provider/user/pw.rb +1 -1
  18. data/lib/chef/provider/user/windows.rb +1 -1
  19. data/lib/chef/resource/breakpoint.rb +1 -1
  20. data/lib/chef/version.rb +3 -1
  21. data/lib/chef/version_string.rb +143 -0
  22. data/spec/functional/mixin/powershell_out_spec.rb +20 -4
  23. data/spec/functional/resource/group_spec.rb +19 -13
  24. data/spec/functional/resource/windows_task_spec.rb +2 -9
  25. data/spec/integration/knife/common_options_spec.rb +29 -11
  26. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +2 -2
  27. data/spec/integration/knife/cookbook_show_spec.rb +2 -2
  28. data/spec/integration/knife/environment_compare_spec.rb +2 -2
  29. data/spec/integration/knife/environment_show_spec.rb +2 -2
  30. data/spec/integration/knife/role_show_spec.rb +2 -2
  31. data/spec/integration/recipes/accumulator_spec.rb +6 -6
  32. data/spec/integration/recipes/resource_action_spec.rb +18 -7
  33. data/spec/integration/recipes/resource_load_spec.rb +5 -21
  34. data/spec/spec_helper.rb +2 -0
  35. data/spec/support/platform_helpers.rb +5 -0
  36. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +1 -1
  37. data/spec/unit/application/client_spec.rb +2 -0
  38. data/spec/unit/knife_spec.rb +22 -0
  39. data/spec/unit/policy_builder/policyfile_spec.rb +50 -0
  40. data/spec/unit/provider/group/groupadd_spec.rb +1 -1
  41. data/spec/unit/provider/user/pw_spec.rb +1 -1
  42. data/spec/unit/version_string_spec.rb +79 -0
  43. data/tasks/dependencies.rb +1 -42
  44. metadata +6 -79
  45. data/acceptance/.bundle/config +0 -2
  46. data/acceptance/bin/aws.rb +0 -17
  47. data/acceptance/bin/berks +0 -17
  48. data/acceptance/bin/bundler +0 -17
  49. data/acceptance/bin/chef-acceptance +0 -17
  50. data/acceptance/bin/coderay +0 -17
  51. data/acceptance/bin/erubis +0 -17
  52. data/acceptance/bin/htmldiff +0 -17
  53. data/acceptance/bin/httpclient +0 -17
  54. data/acceptance/bin/inspec +0 -17
  55. data/acceptance/bin/kitchen +0 -17
  56. data/acceptance/bin/ldiff +0 -17
  57. data/acceptance/bin/nokogiri +0 -17
  58. data/acceptance/bin/pry +0 -17
  59. data/acceptance/bin/rake +0 -17
  60. data/acceptance/bin/rspec +0 -17
  61. data/acceptance/bin/rwinrm +0 -17
  62. data/acceptance/bin/rwinrmcp +0 -17
  63. data/acceptance/bin/safe_yaml +0 -17
  64. data/acceptance/bin/thor +0 -17
  65. data/acceptance/fips/.kitchen/fips-unit-functional-centos-6.yml +0 -7
  66. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  67. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  68. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/id +0 -1
  69. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  70. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/private_key +0 -27
  71. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  72. data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/Vagrantfile +0 -11
  73. data/acceptance/fips/.kitchen/logs/fips-integration-centos-6.log +0 -0
  74. data/acceptance/fips/.kitchen/logs/fips-integration-windows-2012r2.log +0 -0
  75. data/acceptance/fips/.kitchen/logs/fips-unit-functional-centos-6.log +0 -80
  76. data/acceptance/fips/.kitchen/logs/kitchen.log +0 -4
  77. data/tasks/bundle.rb +0 -73
@@ -486,7 +486,11 @@ class Chef
486
486
  ui.error "Failed to authenticate to #{server_url} as #{username} with key #{api_key}"
487
487
  ui.info "Response: #{format_rest_error(response)}"
488
488
  when Net::HTTPForbidden
489
- ui.error "You authenticated successfully to #{server_url} as #{username} but you are not authorized for this action"
489
+ ui.error "You authenticated successfully to #{server_url} as #{username} but you are not authorized for this action."
490
+ proxy_env_vars = ENV.to_hash.keys.map(&:downcase) & %w{http_proxy https_proxy ftp_proxy socks_proxy no_proxy}
491
+ unless proxy_env_vars.empty?
492
+ ui.error "There are proxy servers configured, your Chef server may need to be added to NO_PROXY."
493
+ end
490
494
  ui.info "Response: #{format_rest_error(response)}"
491
495
  when Net::HTTPBadRequest
492
496
  ui.error "The data in your request was invalid"
@@ -43,7 +43,7 @@ class Chef
43
43
  :description => "Test all cookbooks, rather than just a single cookbook"
44
44
 
45
45
  def run
46
- ui.warn("DEPRECATED: Please use ChefSpec or Rubocop to syntax-check cookbooks.")
46
+ ui.warn("DEPRECATED: Please use ChefSpec or Cookstyle to syntax-check cookbooks.")
47
47
  config[:cookbook_path] ||= Chef::Config[:cookbook_path]
48
48
 
49
49
  checked_a_cookbook = false
@@ -51,7 +51,32 @@ class Chef
51
51
 
52
52
  class PolicyfileError < StandardError; end
53
53
 
54
- RunListExpansionIsh = Struct.new(:recipes, :roles)
54
+ RunListExpansionIsh = Struct.new(:recipes, :roles) do
55
+ # Implementing the parts of the RunListExpansion
56
+ # interface we need to properly send this through to
57
+ # events.run_list_expanded as it is expecting a RunListExpansion
58
+ # object.
59
+ def to_hash
60
+ # It looks like version only gets populated in the expanded_run_list when
61
+ # using a little used feature of roles to version lock cookbooks, so
62
+ # version is not reliable in here anyway (places like Automate UI are
63
+ # not getting version out of here.
64
+ #
65
+ # Skipped will always be false as it can only be true when two expanded
66
+ # roles contain the same recipe.
67
+ expanded_run_list = recipes.map do |r|
68
+ { type: "recipe", name: r, skipped: false, version: nil }
69
+ end
70
+ data_collector_hash = {}
71
+ data_collector_hash[:id] = "_policy_node"
72
+ data_collector_hash[:run_list] = expanded_run_list
73
+ data_collector_hash
74
+ end
75
+
76
+ def to_json(*opts)
77
+ to_hash.to_json(*opts)
78
+ end
79
+ end
55
80
 
56
81
  attr_reader :events
57
82
  attr_reader :node
@@ -137,6 +162,7 @@ class Chef
137
162
  Chef::Log.info("Run List expands to [#{run_list_with_versions_for_display.join(', ')}]")
138
163
 
139
164
  events.node_load_completed(node, run_list_with_versions_for_display, Chef::Config)
165
+ events.run_list_expanded(run_list_expansion_ish)
140
166
 
141
167
  node
142
168
  rescue Exception => e
@@ -328,8 +328,6 @@ class Chef
328
328
  resource.class.properties.each do |name, property|
329
329
  class_eval(<<-EOM, __FILE__, __LINE__)
330
330
  def #{name}(*args, &block)
331
- # FIXME: DEPRECATE THIS IN CHEF 13.1
332
- #
333
331
  # If no arguments were passed, we process "get" by defaulting
334
332
  # the value to current_resource, not new_resource. This helps
335
333
  # avoid issues where resources accidentally overwrite perfectly
@@ -350,9 +348,11 @@ class Chef
350
348
  #
351
349
  if args.empty? && !block
352
350
  if !new_resource.property_is_set?(__method__) && current_resource
351
+ Chef.deprecated(:namespace_collisions, "rename #{name} to current_resource.#{name}")
353
352
  return current_resource.public_send(__method__)
354
353
  end
355
354
  end
355
+ Chef.deprecated(:namespace_collisions, "rename #{name} to new_resource.#{name}")
356
356
  new_resource.public_send(__method__, *args, &block)
357
357
  end
358
358
  EOM
@@ -63,7 +63,7 @@ class Chef
63
63
 
64
64
  def set_options
65
65
  opts = []
66
- { gid: "id" }.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
66
+ { gid: "id" }.sort_by { |a| a[0] }.each do |field, option|
67
67
  next unless current_resource.send(field) != new_resource.send(field)
68
68
  if new_resource.send(field)
69
69
  Chef::Log.debug("#{new_resource} setting #{field} to #{new_resource.send(field)}")
@@ -108,7 +108,7 @@ class Chef
108
108
  # <string>:: A string containing the option and then the quoted value
109
109
  def set_options
110
110
  opts = []
111
- { gid: "-g" }.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
111
+ { gid: "-g" }.sort_by { |a| a[0] }.each do |field, option|
112
112
  next unless current_resource.send(field) != new_resource.send(field)
113
113
  next unless new_resource.send(field)
114
114
  opts << option
@@ -257,7 +257,7 @@ EOS
257
257
  choco_command(*args).stdout.each_line do |line|
258
258
  next if line.start_with?("Chocolatey v")
259
259
  name, version = line.split("|")
260
- hash[name.downcase] = version.chomp
260
+ hash[name.downcase] = version&.chomp
261
261
  end
262
262
  hash
263
263
  end
@@ -74,7 +74,7 @@ class Chef
74
74
  "uid" => "-u",
75
75
  "shell" => "-s",
76
76
  }
77
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
77
+ field_list.sort_by { |a| a[0] }.each do |field, option|
78
78
  field_symbol = field.to_sym
79
79
  next unless current_resource.send(field_symbol) != new_resource.send(field_symbol)
80
80
  if new_resource.send(field_symbol)
@@ -107,7 +107,7 @@ class Chef
107
107
  "password" => "password",
108
108
  }
109
109
 
110
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
110
+ field_list.sort_by { |a| a[0] }.each do |field, option|
111
111
  field_symbol = field.to_sym
112
112
  next unless current_resource.send(field_symbol) != new_resource.send(field_symbol)
113
113
  next unless new_resource.send(field_symbol)
@@ -22,7 +22,7 @@ class Chef
22
22
  class Resource
23
23
  class Breakpoint < Chef::Resource
24
24
  provides :breakpoint
25
- resource_name :breakpoinst
25
+ resource_name :breakpoint
26
26
 
27
27
  default_action :break
28
28
 
@@ -19,9 +19,11 @@
19
19
  # task instead.
20
20
  #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21
21
 
22
+ require "chef/version_string"
23
+
22
24
  class Chef
23
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
24
- VERSION = "13.1.31"
26
+ VERSION = Chef::VersionString.new("13.2.20")
25
27
  end
26
28
 
27
29
  #
@@ -0,0 +1,143 @@
1
+ # Copyright:: Copyright 2017, Noah Kantrowitz
2
+ # License:: Apache License, Version 2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ class Chef
17
+ # String-like object for version strings.
18
+ #
19
+ # @since 13.2
20
+ # @api internal
21
+ class VersionString < String
22
+ # Parsed version object for the string.
23
+ # @return [Gem::Version]
24
+ attr_reader :parsed_version
25
+
26
+ # Create a new VersionString from an input String.
27
+ #
28
+ # @param val [String] Version string to parse.
29
+ def initialize(val)
30
+ super
31
+ @parsed_version = ::Gem::Version.create(self)
32
+ end
33
+
34
+ # @!group Compat wrappers for String
35
+
36
+ # Compat wrapper for + to behave like a normal String.
37
+ #
38
+ # @param other [String]
39
+ # @return [String]
40
+ def +(other)
41
+ to_s + other
42
+ end
43
+
44
+ # Compat wrapper for * to behave like a normal String.
45
+ #
46
+ # @param other [Integer]
47
+ # @return [String]
48
+ def *(other)
49
+ to_s * other
50
+ end
51
+
52
+ # @!group Comparison operators
53
+
54
+ # Compare a VersionString to an object. If compared to another VersionString
55
+ # then sort like `Gem::Version`, otherwise try to treat the other object as
56
+ # a version but fall back to normal string comparison.
57
+ #
58
+ # @param other [Object]
59
+ # @return [Integer]
60
+ def <=>(other)
61
+ other_ver = case other
62
+ when VersionString
63
+ other.parsed_version
64
+ else
65
+ begin
66
+ Gem::Version.create(other.to_s)
67
+ rescue ArgumentError
68
+ # Comparing to a string that isn't a version.
69
+ return super
70
+ end
71
+ end
72
+ parsed_version <=> other_ver
73
+ end
74
+
75
+ # Compat wrapper for == based on <=>.
76
+ #
77
+ # @param other [Object]
78
+ # @return [Boolean]
79
+ def ==(other)
80
+ (self <=> other) == 0
81
+ end
82
+
83
+ # Compat wrapper for != based on <=>.
84
+ #
85
+ # @param other [Object]
86
+ # @return [Boolean]
87
+ def !=(other)
88
+ (self <=> other) != 0
89
+ end
90
+
91
+ # Compat wrapper for < based on <=>.
92
+ #
93
+ # @param other [Object]
94
+ # @return [Boolean]
95
+ def <(other)
96
+ (self <=> other) < 0
97
+ end
98
+
99
+ # Compat wrapper for <= based on <=>.
100
+ #
101
+ # @param other [Object]
102
+ # @return [Boolean]
103
+ def <=(other)
104
+ (self <=> other) < 1
105
+ end
106
+
107
+ # Compat wrapper for > based on <=>.
108
+ #
109
+ # @param other [Object]
110
+ # @return [Boolean]
111
+ def >(other)
112
+ (self <=> other) > 0
113
+ end
114
+
115
+ # Compat wrapper for >= based on <=>.
116
+ #
117
+ # @param other [Object]
118
+ # @return [Boolean]
119
+ def >=(other)
120
+ (self <=> other) > -1
121
+ end
122
+
123
+ # @!group Matching operators
124
+
125
+ # Matching operator to support checking against a requirement string.
126
+ #
127
+ # @param other [Regexp, String]
128
+ # @return [Boolean]
129
+ # @example Match against a Regexp
130
+ # Chef::VersionString.new('1.0.0') =~ /^1/
131
+ # @example Match against a requirement
132
+ # Chef::VersionString.new('1.0.0') =~ '~> 1.0'
133
+ def =~(other)
134
+ case other
135
+ when Regexp
136
+ super
137
+ else
138
+ Gem::Requirement.create(other) =~ parsed_version
139
+ end
140
+ end
141
+
142
+ end
143
+ end
@@ -22,8 +22,16 @@ describe Chef::Mixin::PowershellOut, windows_only: true do
22
22
  include Chef::Mixin::PowershellOut
23
23
 
24
24
  describe "#powershell_out" do
25
- it "runs a powershell command and collects stdout" do
26
- expect(powershell_out("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+VM\(M\)\s+CPU\(s\)\s+Id\s+/
25
+ context "for windows version less than 10", windows_lt_10: true do
26
+ it "runs a powershell command and collects stdout" do
27
+ expect(powershell_out("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+VM\(M\)\s+CPU\(s\)\s+Id\s+/
28
+ end
29
+ end
30
+
31
+ context "for windows version greater than 10", windows_gte_10: true do
32
+ it "runs a powershell command and collects stdout" do
33
+ expect(powershell_out("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+CPU\(s\)\s+Id\s+SI\s+ProcessName\s+/
34
+ end
27
35
  end
28
36
 
29
37
  it "does not raise exceptions when the command is invalid" do
@@ -32,8 +40,16 @@ describe Chef::Mixin::PowershellOut, windows_only: true do
32
40
  end
33
41
 
34
42
  describe "#powershell_out!" do
35
- it "runs a powershell command and collects stdout" do
36
- expect(powershell_out!("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+VM\(M\)\s+CPU\(s\)\s+Id\s+/
43
+ context "for windows version less than 10", windows_lt_10: true do
44
+ it "runs a powershell command and collects stdout" do
45
+ expect(powershell_out!("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+VM\(M\)\s+CPU\(s\)\s+Id\s+/
46
+ end
47
+ end
48
+
49
+ context "for windows version less than 10", windows_gte_10: true do
50
+ it "runs a powershell command and collects stdout" do
51
+ expect(powershell_out("get-process").run_command.stdout).to match /Handles\s+NPM\(K\)\s+PM\(K\)\s+WS\(K\)\s+CPU\(s\)\s+Id\s+SI\s+ProcessName\s+/
52
+ end
37
53
  end
38
54
 
39
55
  it "raises exceptions when the command is invalid" do
@@ -335,19 +335,6 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" end
335
335
  end
336
336
  end
337
337
 
338
- describe "when group name length is more than 256", :windows_only do
339
- let!(:group_name) do
340
- "theoldmanwalkingdownthestreetalwayshadagood\
341
- smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
342
- theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
343
- downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
344
-
345
- it "should not create a group" do
346
- expect { group_resource.run_action(:create) }.to raise_error(ArgumentError)
347
- group_should_not_exist(group_name)
348
- end
349
- end
350
-
351
338
  # not_supported_on_solaris because of the use of excluded_members
352
339
  describe "should raise an error when same member is included in the members and excluded_members", :not_supported_on_solaris do
353
340
  it "should raise an error" do
@@ -359,6 +346,25 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
359
346
  end
360
347
  end
361
348
 
349
+ # Note:This testcase is written separately from the `group create action` defined above because
350
+ # for group name > 256, Windows 2016 returns "The parameter is incorrect"
351
+ context "group create action: when group name length is more than 256", :windows_only do
352
+ let!(:group_name) do
353
+ "theoldmanwalkingdownthestreetalwayshadagood\
354
+ smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
355
+ theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
356
+ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
357
+
358
+ it "should not create a group" do
359
+ expect { group_resource.run_action(:create) }.to raise_error(ArgumentError)
360
+ if windows_gte_10?
361
+ expect { Chef::Util::Windows::NetGroup.new(group_name).local_get_members }.to raise_error(ArgumentError, /The parameter is incorrect./)
362
+ else
363
+ group_should_not_exist(group_name)
364
+ end
365
+ end
366
+ end
367
+
362
368
  describe "group remove action" do
363
369
  describe "when there is a group" do
364
370
  before do
@@ -62,7 +62,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
62
62
  subject.run_action(:create)
63
63
  task_details = windows_task_provider.send(:load_task_hash, task_name)
64
64
  expect(task_details[:TaskName]).to eq("\\chef-client")
65
- expect(task_details[:Status]).to eq("Ready")
66
65
  expect(task_details[:TaskToRun]).to eq("chef-client")
67
66
  expect(task_details[:"Repeat:Every"]).to eq("0 Hour(s), 15 Minute(s)")
68
67
  expect(task_details[:run_level]).to eq("HighestAvailable")
@@ -83,7 +82,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
83
82
  subject.run_action(:create)
84
83
  task_details = windows_task_provider.send(:load_task_hash, task_name)
85
84
  expect(task_details[:TaskName]).to eq("\\chef-client")
86
- expect(task_details[:Status]).to eq("Ready")
87
85
  expect(task_details[:TaskToRun]).to eq("chef-client")
88
86
  expect(task_details[:"Repeat:Every"]).to eq("3 Hour(s), 0 Minute(s)")
89
87
  expect(task_details[:run_level]).to eq("HighestAvailable")
@@ -103,7 +101,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
103
101
  subject.run_action(:create)
104
102
  task_details = windows_task_provider.send(:load_task_hash, task_name)
105
103
  expect(task_details[:TaskName]).to eq("\\chef-client")
106
- expect(task_details[:Status]).to eq("Ready")
107
104
  expect(task_details[:TaskToRun]).to eq("chef-client")
108
105
  expect(task_details[:ScheduleType]).to eq("Daily")
109
106
  expect(task_details[:Days]).to eq("Every 1 day(s)")
@@ -125,7 +122,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
125
122
  subject.run_action(:create)
126
123
  task_details = windows_task_provider.send(:load_task_hash, task_name)
127
124
  expect(task_details[:TaskName]).to eq("\\chef-client")
128
- expect(task_details[:Status]).to eq("Ready")
129
125
  expect(task_details[:TaskToRun]).to eq("chef-client")
130
126
  expect(task_details[:ScheduleType]).to eq("Monthly")
131
127
  expect(task_details[:Months]).to eq("FEB, APR, JUN, AUG, OCT, DEC")
@@ -154,7 +150,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
154
150
  subject.run_action(:create)
155
151
  task_details = windows_task_provider.send(:load_task_hash, task_name)
156
152
  expect(task_details[:TaskName]).to eq("\\chef-client")
157
- expect(task_details[:Status]).to eq("Ready")
158
153
  expect(task_details[:TaskToRun]).to eq("chef-client")
159
154
  expect(task_details[:ScheduleType]).to eq("One Time Only")
160
155
  expect(task_details[:StartTime]).to eq("5:00:00 PM")
@@ -176,7 +171,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
176
171
  subject.run_action(:create)
177
172
  task_details = windows_task_provider.send(:load_task_hash, task_name)
178
173
  expect(task_details[:TaskName]).to eq("\\chef-client")
179
- expect(task_details[:Status]).to eq("Ready")
180
174
  expect(task_details[:TaskToRun]).to eq("chef-client")
181
175
  expect(task_details[:ScheduleType]).to eq("Weekly")
182
176
  expect(task_details[:Months]).to eq("Every 1 week(s)")
@@ -190,7 +184,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
190
184
  subject.run_action(:create)
191
185
  task_details = windows_task_provider.send(:load_task_hash, task_name)
192
186
  expect(task_details[:TaskName]).to eq("\\chef-client")
193
- expect(task_details[:Status]).to eq("Ready")
194
187
  expect(task_details[:TaskToRun]).to eq("chef-client")
195
188
  expect(task_details[:Days]).to eq("MON, FRI")
196
189
  expect(task_details[:ScheduleType]).to eq("Weekly")
@@ -227,7 +220,6 @@ describe Chef::Resource::WindowsTask, :windows_only do
227
220
  subject.run_action(:create)
228
221
  task_details = windows_task_provider.send(:load_task_hash, task_name)
229
222
  expect(task_details[:TaskName]).to eq("\\chef-client")
230
- expect(task_details[:Status]).to eq("Ready")
231
223
  expect(task_details[:TaskToRun]).to eq("chef-client")
232
224
  expect(task_details[:ScheduleType]).to eq("At logon time")
233
225
  expect(task_details[:run_level]).to eq("HighestAvailable")
@@ -401,7 +393,8 @@ describe Chef::Resource::WindowsTask, :windows_only do
401
393
 
402
394
  subject do
403
395
  new_resource = Chef::Resource::WindowsTask.new(task_name, run_context)
404
- new_resource.command task_name
396
+ new_resource.command "dir"
397
+ new_resource.run_level :highest
405
398
  new_resource
406
399
  end
407
400