chef 11.12.0.alpha.1 → 11.12.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/api_client/registration.rb +46 -9
  3. data/lib/chef/application.rb +1 -0
  4. data/lib/chef/application/client.rb +25 -24
  5. data/lib/chef/client.rb +34 -0
  6. data/lib/chef/config.rb +11 -0
  7. data/lib/chef/cookbook/chefignore.rb +10 -2
  8. data/lib/chef/cookbook/metadata.rb +31 -3
  9. data/lib/chef/cookbook/synchronizer.rb +2 -2
  10. data/lib/chef/cookbook/syntax_check.rb +4 -4
  11. data/lib/chef/encrypted_data_bag_item.rb +37 -1
  12. data/lib/chef/exceptions.rb +1 -0
  13. data/lib/chef/guard_interpreter/default_guard_interpreter.rb +42 -0
  14. data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +122 -0
  15. data/lib/chef/http.rb +0 -1
  16. data/lib/chef/http/decompressor.rb +7 -4
  17. data/lib/chef/http/simple.rb +5 -0
  18. data/lib/chef/http/validate_content_length.rb +28 -12
  19. data/lib/chef/knife.rb +1 -0
  20. data/lib/chef/knife/client_bulk_delete.rb +48 -9
  21. data/lib/chef/knife/client_delete.rb +4 -4
  22. data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
  23. data/lib/chef/knife/cookbook_upload.rb +17 -7
  24. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  25. data/lib/chef/knife/core/ui.rb +42 -5
  26. data/lib/chef/knife/node_run_list_add.rb +31 -2
  27. data/lib/chef/knife/ssh.rb +44 -31
  28. data/lib/chef/knife/ssl_check.rb +213 -0
  29. data/lib/chef/knife/ssl_fetch.rb +145 -0
  30. data/lib/chef/mixin/deep_merge.rb +13 -5
  31. data/lib/chef/mixin/shell_out.rb +9 -3
  32. data/lib/chef/node.rb +23 -4
  33. data/lib/chef/node/immutable_collections.rb +32 -0
  34. data/lib/chef/platform/provider_mapping.rb +21 -18
  35. data/lib/chef/platform/query_helpers.rb +10 -2
  36. data/lib/chef/policy_builder/expand_node_object.rb +3 -6
  37. data/lib/chef/provider/cron.rb +25 -3
  38. data/lib/chef/provider/mount/mount.rb +1 -1
  39. data/lib/chef/provider/package/dpkg.rb +2 -1
  40. data/lib/chef/provider/package/windows.rb +80 -0
  41. data/lib/chef/provider/package/windows/msi.rb +69 -0
  42. data/lib/chef/provider/powershell_script.rb +19 -6
  43. data/lib/chef/provider/service/solaris.rb +11 -7
  44. data/lib/chef/resource.rb +18 -5
  45. data/lib/chef/resource/conditional.rb +20 -7
  46. data/lib/chef/resource/cron.rb +18 -2
  47. data/lib/chef/resource/execute.rb +0 -2
  48. data/lib/chef/resource/powershell_script.rb +23 -1
  49. data/lib/chef/resource/script.rb +25 -0
  50. data/lib/chef/resource/subversion.rb +4 -0
  51. data/lib/chef/resource/windows_package.rb +79 -0
  52. data/lib/chef/resource/windows_script.rb +0 -5
  53. data/lib/chef/resources.rb +1 -0
  54. data/lib/chef/rest.rb +6 -1
  55. data/lib/chef/run_context.rb +22 -2
  56. data/lib/chef/run_context/cookbook_compiler.rb +12 -0
  57. data/lib/chef/util/editor.rb +92 -0
  58. data/lib/chef/util/file_edit.rb +22 -54
  59. data/lib/chef/version.rb +2 -2
  60. data/lib/chef/win32/api/installer.rb +166 -0
  61. data/lib/chef/win32/version.rb +8 -0
  62. data/spec/data/standalone_cookbook/Gemfile +1 -0
  63. data/spec/data/standalone_cookbook/chefignore +9 -0
  64. data/spec/data/standalone_cookbook/recipes/default.rb +3 -0
  65. data/spec/data/standalone_cookbook/vendor/bundle/ruby/2.0.0/gems/multi_json-1.9.0/lib/multi_json.rb +1 -0
  66. data/spec/functional/resource/powershell_spec.rb +262 -1
  67. data/spec/functional/win32/versions_spec.rb +3 -3
  68. data/spec/integration/knife/chefignore_spec.rb +1 -2
  69. data/spec/integration/knife/raw_spec.rb +8 -13
  70. data/spec/integration/knife/redirection_spec.rb +6 -14
  71. data/spec/integration/solo/solo_spec.rb +19 -0
  72. data/spec/support/shared/functional/windows_script.rb +1 -1
  73. data/spec/support/shared/integration/app_server_support.rb +42 -0
  74. data/spec/support/shared/integration/integration_helper.rb +1 -0
  75. data/spec/support/shared/unit/script_resource.rb +38 -0
  76. data/spec/unit/api_client/registration_spec.rb +109 -38
  77. data/spec/unit/application/client_spec.rb +48 -1
  78. data/spec/unit/cookbook/chefignore_spec.rb +10 -0
  79. data/spec/unit/cookbook/metadata_spec.rb +45 -1
  80. data/spec/unit/cookbook/syntax_check_spec.rb +28 -0
  81. data/spec/unit/cookbook_spec.rb +0 -10
  82. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +56 -0
  83. data/spec/unit/http/simple_spec.rb +32 -0
  84. data/spec/unit/http/validate_content_length_spec.rb +187 -0
  85. data/spec/unit/knife/bootstrap_spec.rb +13 -4
  86. data/spec/unit/knife/client_bulk_delete_spec.rb +123 -38
  87. data/spec/unit/knife/client_delete_spec.rb +4 -4
  88. data/spec/unit/knife/cookbook_upload_spec.rb +181 -88
  89. data/spec/unit/knife/core/bootstrap_context_spec.rb +11 -1
  90. data/spec/unit/knife/core/ui_spec.rb +109 -38
  91. data/spec/unit/knife/node_run_list_add_spec.rb +24 -1
  92. data/spec/unit/knife/ssh_spec.rb +17 -6
  93. data/spec/unit/knife/ssl_check_spec.rb +187 -0
  94. data/spec/unit/knife/ssl_fetch_spec.rb +151 -0
  95. data/spec/unit/mixin/deep_merge_spec.rb +17 -0
  96. data/spec/unit/node/immutable_collections_spec.rb +55 -0
  97. data/spec/unit/node_spec.rb +9 -0
  98. data/spec/unit/platform/query_helpers_spec.rb +32 -0
  99. data/spec/unit/platform_spec.rb +193 -175
  100. data/spec/unit/policy_builder/expand_node_object_spec.rb +1 -1
  101. data/spec/unit/provider/cron_spec.rb +175 -1
  102. data/spec/unit/provider/mount/mount_spec.rb +33 -3
  103. data/spec/unit/provider/package/dpkg_spec.rb +4 -0
  104. data/spec/unit/provider/package/windows/msi_spec.rb +60 -0
  105. data/spec/unit/provider/package/windows_spec.rb +80 -0
  106. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  107. data/spec/unit/provider/service/solaris_smf_service_spec.rb +35 -10
  108. data/spec/unit/pure_application_spec.rb +32 -0
  109. data/spec/unit/recipe_spec.rb +4 -0
  110. data/spec/unit/resource/conditional_spec.rb +13 -12
  111. data/spec/unit/resource/cron_spec.rb +7 -2
  112. data/spec/unit/resource/powershell_spec.rb +85 -2
  113. data/spec/unit/resource/subversion_spec.rb +5 -0
  114. data/spec/unit/resource/windows_package_spec.rb +74 -0
  115. data/spec/unit/resource_spec.rb +23 -1
  116. data/spec/unit/rest_spec.rb +15 -0
  117. data/spec/unit/run_context/cookbook_compiler_spec.rb +12 -0
  118. data/spec/unit/run_context_spec.rb +7 -0
  119. data/spec/unit/util/editor_spec.rb +152 -0
  120. data/spec/unit/util/file_edit_spec.rb +37 -1
  121. metadata +41 -30
@@ -0,0 +1,145 @@
1
+ #
2
+ # Author:: Daniel DeLeo (<dan@getchef.com>)
3
+ # Copyright:: Copyright (c) 2014 Chef Software, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife/ssl_fetch'
20
+ require 'chef/config'
21
+
22
+ class Chef
23
+ class Knife
24
+ class SslFetch < Chef::Knife
25
+
26
+ deps do
27
+ require 'pp'
28
+ require 'socket'
29
+ require 'uri'
30
+ require 'openssl'
31
+ end
32
+
33
+ banner "knife ssl fetch [URL] (options)"
34
+
35
+ def initialize(*args)
36
+ super
37
+ @uri = nil
38
+ end
39
+
40
+ def uri
41
+ @uri ||= begin
42
+ Chef::Log.debug("Checking SSL cert on #{given_uri}")
43
+ URI.parse(given_uri)
44
+ end
45
+ end
46
+
47
+ def given_uri
48
+ (name_args[0] or Chef::Config.chef_server_url)
49
+ end
50
+
51
+ def host
52
+ uri.host
53
+ end
54
+
55
+ def port
56
+ uri.port
57
+ end
58
+
59
+ def validate_uri
60
+ unless host && port
61
+ invalid_uri!
62
+ end
63
+ rescue URI::Error
64
+ invalid_uri!
65
+ end
66
+
67
+ def invalid_uri!
68
+ ui.error("Given URI: `#{given_uri}' is invalid")
69
+ show_usage
70
+ exit 1
71
+ end
72
+
73
+ def remote_cert_chain
74
+ tcp_connection = TCPSocket.new(host, port)
75
+ shady_ssl_connection = OpenSSL::SSL::SSLSocket.new(tcp_connection, noverify_peer_ssl_context)
76
+ shady_ssl_connection.connect
77
+ shady_ssl_connection.peer_cert_chain
78
+ end
79
+
80
+ def noverify_peer_ssl_context
81
+ @noverify_peer_ssl_context ||= begin
82
+ noverify_peer_context = OpenSSL::SSL::SSLContext.new
83
+ noverify_peer_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
84
+ noverify_peer_context
85
+ end
86
+ end
87
+
88
+
89
+ def cn_of(certificate)
90
+ subject = certificate.subject
91
+ cn_field_tuple = subject.to_a.find {|field| field[0] == "CN" }
92
+ cn_field_tuple[1]
93
+ end
94
+
95
+ # Convert the CN of a certificate into something that will work well as a
96
+ # filename. To do so, all `*` characters are converted to the string
97
+ # "wildcard" and then all characters other than alphanumeric and hypen
98
+ # characters are converted to underscores.
99
+ # NOTE: There is some confustion about what the CN will contain when
100
+ # using internationalized domain names. RFC 6125 mandates that the ascii
101
+ # representation be used, but it is not clear whether this is followed in
102
+ # practice.
103
+ # https://tools.ietf.org/html/rfc6125#section-6.4.2
104
+ def normalize_cn(cn)
105
+ cn.gsub("*", "wildcard").gsub(/[^[:alnum:]\-]/, '_')
106
+ end
107
+
108
+ def configuration
109
+ Chef::Config
110
+ end
111
+
112
+ def trusted_certs_dir
113
+ configuration.trusted_certs_dir
114
+ end
115
+
116
+ def write_cert(cert)
117
+ FileUtils.mkdir_p(trusted_certs_dir)
118
+ cn = cn_of(cert)
119
+ filename = File.join(trusted_certs_dir, "#{normalize_cn(cn)}.crt")
120
+ ui.msg("Adding certificate for #{cn} in #{filename}")
121
+ File.open(filename, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
122
+ f.print(cert.to_s)
123
+ end
124
+ end
125
+
126
+ def run
127
+ validate_uri
128
+ ui.warn(<<-TRUST_TRUST)
129
+ Certificates from #{host} will be fetched and placed in your trusted_cert
130
+ directory (#{trusted_certs_dir}).
131
+
132
+ Knife has no means to verify these are the correct certificates. You should
133
+ verify the authenticity of these certificates after downloading.
134
+
135
+ TRUST_TRUST
136
+ remote_cert_chain.each do |cert|
137
+ write_cert(cert)
138
+ end
139
+ end
140
+
141
+
142
+ end
143
+ end
144
+ end
145
+
@@ -111,7 +111,13 @@ class Chef
111
111
  end # deep_merge!
112
112
 
113
113
  def hash_only_merge(merge_onto, merge_with)
114
- hash_only_merge!(merge_onto.dup, merge_with.dup)
114
+ hash_only_merge!(safe_dup(merge_onto), safe_dup(merge_with))
115
+ end
116
+
117
+ def safe_dup(thing)
118
+ thing.dup
119
+ rescue TypeError
120
+ thing
115
121
  end
116
122
 
117
123
  # Deep merge without Array merge.
@@ -122,7 +128,11 @@ class Chef
122
128
  # If there are two Hashes, recursively merge.
123
129
  if merge_onto.kind_of?(Hash) && merge_with.kind_of?(Hash)
124
130
  merge_with.each do |key, merge_with_value|
125
- merge_onto[key] = hash_only_merge!(merge_onto[key], merge_with_value)
131
+ merge_onto[key] = if merge_onto.has_key?(key)
132
+ hash_only_merge(merge_onto[key], merge_with_value)
133
+ else
134
+ merge_with_value
135
+ end
126
136
  end
127
137
  merge_onto
128
138
 
@@ -158,11 +168,9 @@ class Chef
158
168
  end
159
169
 
160
170
  def deep_merge(source, dest)
161
- deep_merge!(source.dup, dest.dup)
171
+ deep_merge!(safe_dup(source), safe_dup(dest))
162
172
  end
163
173
 
164
174
  end
165
175
  end
166
176
  end
167
-
168
-
@@ -33,9 +33,7 @@ class Chef
33
33
 
34
34
  def shell_out(*command_args)
35
35
  cmd = Mixlib::ShellOut.new(*run_command_compatible_options(command_args))
36
- if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug?
37
- cmd.live_stream = STDOUT
38
- end
36
+ cmd.live_stream = io_for_live_stream
39
37
  cmd.run_command
40
38
  cmd
41
39
  end
@@ -73,6 +71,14 @@ class Chef
73
71
  def deprecate_option(old_option, new_option)
74
72
  Chef::Log.logger.warn "DEPRECATION: Chef::Mixin::ShellOut option :#{old_option} is deprecated. Use :#{new_option}"
75
73
  end
74
+
75
+ def io_for_live_stream
76
+ if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug?
77
+ STDOUT
78
+ else
79
+ nil
80
+ end
81
+ end
76
82
  end
77
83
  end
78
84
  end
@@ -42,7 +42,7 @@ class Chef
42
42
 
43
43
  def_delegators :attributes, :keys, :each_key, :each_value, :key?, :has_key?
44
44
 
45
- attr_accessor :recipe_list, :run_state, :run_list
45
+ attr_accessor :recipe_list, :run_state, :override_runlist
46
46
 
47
47
  # RunContext will set itself as run_context via this setter when
48
48
  # initialized. This is needed so DSL::IncludeAttribute (in particular,
@@ -63,7 +63,8 @@ class Chef
63
63
  @name = nil
64
64
 
65
65
  @chef_environment = '_default'
66
- @run_list = Chef::RunList.new
66
+ @primary_runlist = Chef::RunList.new
67
+ @override_runlist = Chef::RunList.new
67
68
 
68
69
  @attributes = Chef::Node::Attribute.new({}, {}, {}, {})
69
70
 
@@ -259,10 +260,28 @@ class Chef
259
260
  run_list.include?("role[#{role_name}]")
260
261
  end
261
262
 
263
+ def primary_runlist
264
+ @primary_runlist
265
+ end
266
+
267
+ def override_runlist(*args)
268
+ args.length > 0 ? @override_runlist.reset!(args) : @override_runlist
269
+ end
270
+
271
+ def select_run_list
272
+ @override_runlist.empty? ? @primary_runlist : @override_runlist
273
+ end
274
+
262
275
  # Returns an Array of roles and recipes, in the order they will be applied.
263
276
  # If you call it with arguments, they will become the new list of roles and recipes.
264
277
  def run_list(*args)
265
- args.length > 0 ? @run_list.reset!(args) : @run_list
278
+ rl = select_run_list
279
+ args.length > 0 ? rl.reset!(args) : rl
280
+ end
281
+
282
+ def run_list=(list)
283
+ rl = select_run_list
284
+ rl = list
266
285
  end
267
286
 
268
287
  # Returns true if this Node expects a given role, false if not.
@@ -410,7 +429,7 @@ class Chef
410
429
  "default" => attributes.combined_default,
411
430
  "override" => attributes.combined_override,
412
431
  #Render correctly for run_list items so malformed json does not result
413
- "run_list" => run_list.run_list.map { |item| item.to_s }
432
+ "run_list" => @primary_runlist.run_list.map { |item| item.to_s }
414
433
  }
415
434
  result
416
435
  end
@@ -96,6 +96,22 @@ class Chef
96
96
  Array.new(map {|e| safe_dup(e)})
97
97
  end
98
98
 
99
+ def to_a
100
+ a = Array.new
101
+ each do |v|
102
+ a <<
103
+ case v
104
+ when ImmutableArray
105
+ v.to_a
106
+ when ImmutableMash
107
+ v.to_hash
108
+ else
109
+ v
110
+ end
111
+ end
112
+ a
113
+ end
114
+
99
115
  end
100
116
 
101
117
  # == ImmutableMash
@@ -187,6 +203,22 @@ class Chef
187
203
  Mash.new(self)
188
204
  end
189
205
 
206
+ def to_hash
207
+ h = Hash.new
208
+ each_pair do |k, v|
209
+ h[k] =
210
+ case v
211
+ when ImmutableMash
212
+ v.to_hash
213
+ when ImmutableArray
214
+ v.to_a
215
+ else
216
+ v
217
+ end
218
+ end
219
+ h
220
+ end
221
+
190
222
  end
191
223
 
192
224
  end
@@ -180,6 +180,7 @@ class Chef
180
180
  :package => Chef::Provider::Package::Zypper,
181
181
  :group => Chef::Provider::Group::Suse
182
182
  },
183
+ # Only OpenSuSE 12.3+ should use the Usermod group provider:
183
184
  ">= 12.3" => {
184
185
  :group => Chef::Provider::Group::Usermod
185
186
  }
@@ -190,19 +191,6 @@ class Chef
190
191
  :cron => Chef::Provider::Cron,
191
192
  :package => Chef::Provider::Package::Zypper,
192
193
  :group => Chef::Provider::Group::Suse
193
- },
194
- ###############################################
195
- # TODO: Remove this after ohai update is released.
196
- # Only OpenSuSE 12.3+ should use the Usermod group provider:
197
- # Ohai before OHAI-339 is applied reports both OpenSuSE and SuSE
198
- # Enterprise as "suse", Ohai after OHAI-339 will report OpenSuSE as
199
- # "opensuse".
200
- #
201
- # In order to support OpenSuSE both before and after the Ohai
202
- # change, I'm leaving this here. It needs to get removed before
203
- # SuSE enterprise 12.3 ships.
204
- ">= 12.3" => {
205
- :group => Chef::Provider::Group::Usermod
206
194
  }
207
195
  },
208
196
  :oracle => {
@@ -222,6 +210,15 @@ class Chef
222
210
  :ifconfig => Chef::Provider::Ifconfig::Redhat
223
211
  }
224
212
  },
213
+ :ibm_powerkvm => {
214
+ :default => {
215
+ :service => Chef::Provider::Service::Redhat,
216
+ :cron => Chef::Provider::Cron,
217
+ :package => Chef::Provider::Package::Yum,
218
+ :mdadm => Chef::Provider::Mdadm,
219
+ :ifconfig => Chef::Provider::Ifconfig::Redhat
220
+ }
221
+ },
225
222
  :gentoo => {
226
223
  :default => {
227
224
  :package => Chef::Provider::Package::Portage,
@@ -233,7 +230,7 @@ class Chef
233
230
  :arch => {
234
231
  :default => {
235
232
  :package => Chef::Provider::Package::Pacman,
236
- :service => Chef::Provider::Service::Arch,
233
+ :service => Chef::Provider::Service::Systemd,
237
234
  :cron => Chef::Provider::Cron,
238
235
  :mdadm => Chef::Provider::Mdadm
239
236
  }
@@ -244,7 +241,9 @@ class Chef
244
241
  :service => Chef::Provider::Service::Windows,
245
242
  :user => Chef::Provider::User::Windows,
246
243
  :group => Chef::Provider::Group::Windows,
247
- :mount => Chef::Provider::Mount::Windows
244
+ :mount => Chef::Provider::Mount::Windows,
245
+ :batch => Chef::Provider::Batch,
246
+ :powershell_script => Chef::Provider::PowershellScript
248
247
  }
249
248
  },
250
249
  :mingw32 => {
@@ -253,7 +252,9 @@ class Chef
253
252
  :service => Chef::Provider::Service::Windows,
254
253
  :user => Chef::Provider::User::Windows,
255
254
  :group => Chef::Provider::Group::Windows,
256
- :mount => Chef::Provider::Mount::Windows
255
+ :mount => Chef::Provider::Mount::Windows,
256
+ :batch => Chef::Provider::Batch,
257
+ :powershell_script => Chef::Provider::PowershellScript
257
258
  }
258
259
  },
259
260
  :windows => {
@@ -262,7 +263,9 @@ class Chef
262
263
  :service => Chef::Provider::Service::Windows,
263
264
  :user => Chef::Provider::User::Windows,
264
265
  :group => Chef::Provider::Group::Windows,
265
- :mount => Chef::Provider::Mount::Windows
266
+ :mount => Chef::Provider::Mount::Windows,
267
+ :batch => Chef::Provider::Batch,
268
+ :powershell_script => Chef::Provider::PowershellScript
266
269
  }
267
270
  },
268
271
  :solaris => {},
@@ -307,7 +310,7 @@ class Chef
307
310
  :group => Chef::Provider::Group::Usermod,
308
311
  :user => Chef::Provider::User::Solaris,
309
312
  },
310
- ">= 5.9" => {
313
+ "< 5.11" => {
311
314
  :service => Chef::Provider::Service::Solaris,
312
315
  :package => Chef::Provider::Package::Solaris,
313
316
  :cron => Chef::Provider::Cron::Solaris,
@@ -30,11 +30,19 @@ class Chef
30
30
 
31
31
  def windows_server_2003?
32
32
  return false unless windows?
33
-
34
33
  require 'ruby-wmi'
35
34
 
35
+ # CHEF-4888: Work around ruby #2618, expected to be fixed in Ruby 2.1.0
36
+ # https://github.com/ruby/ruby/commit/588504b20f5cc880ad51827b93e571e32446e5db
37
+ # https://github.com/ruby/ruby/commit/27ed294c7134c0de582007af3c915a635a6506cd
38
+ WIN32OLE.ole_initialize
39
+
36
40
  host = WMI::Win32_OperatingSystem.find(:first)
37
- (host.version && host.version.start_with?("5.2"))
41
+ is_server_2003 = (host.version && host.version.start_with?("5.2"))
42
+
43
+ WIN32OLE.ole_uninitialize
44
+
45
+ is_server_2003
38
46
  end
39
47
  end
40
48
 
@@ -40,7 +40,6 @@ class Chef
40
40
  attr_reader :ohai_data
41
41
  attr_reader :json_attribs
42
42
  attr_reader :override_runlist
43
- attr_reader :original_runlist
44
43
  attr_reader :run_context
45
44
  attr_reader :run_list_expansion
46
45
 
@@ -52,7 +51,6 @@ class Chef
52
51
  @events = events
53
52
 
54
53
  @node = nil
55
- @original_runlist = nil
56
54
  @run_list_expansion = nil
57
55
  end
58
56
 
@@ -190,7 +188,7 @@ class Chef
190
188
  # override_runlist was provided. Chef::Client uses this to decide whether
191
189
  # to do the final node save at the end of the run or not.
192
190
  def temporary_policy?
193
- !!@original_runlist
191
+ !node.override_runlist.empty?
194
192
  end
195
193
 
196
194
  ########################################
@@ -200,10 +198,9 @@ class Chef
200
198
  def setup_run_list_override
201
199
  runlist_override_sanity_check!
202
200
  unless(override_runlist.empty?)
203
- @original_runlist = node.run_list.run_list_items.dup
204
- node.run_list(*override_runlist)
201
+ node.override_runlist(*override_runlist)
205
202
  Chef::Log.warn "Run List override has been provided."
206
- Chef::Log.warn "Original Run List: [#{original_runlist.join(', ')}]"
203
+ Chef::Log.warn "Original Run List: [#{node.primary_runlist}]"
207
204
  Chef::Log.warn "Overridden Run List: [#{node.run_list}]"
208
205
  end
209
206
  end