chef 16.0.275 → 16.0.287

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/lib/chef/application/apply.rb +1 -1
  4. data/lib/chef/application/exit_code.rb +2 -2
  5. data/lib/chef/chef_fs/chef_fs_data_store.rb +3 -3
  6. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
  7. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
  8. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +1 -1
  9. data/lib/chef/cookbook_version.rb +4 -4
  10. data/lib/chef/deprecated.rb +1 -1
  11. data/lib/chef/dsl/platform_introspection.rb +1 -1
  12. data/lib/chef/knife/bootstrap.rb +6 -6
  13. data/lib/chef/knife/{user_invite_recind.rb → user_invite_rescind.rb} +6 -6
  14. data/lib/chef/mixin/create_path.rb +8 -8
  15. data/lib/chef/mixin/properties.rb +2 -0
  16. data/lib/chef/node/mixin/deep_merge_cache.rb +7 -7
  17. data/lib/chef/provider/launchd.rb +18 -24
  18. data/lib/chef/provider/service/macosx.rb +4 -2
  19. data/lib/chef/provider/service/simple.rb +3 -3
  20. data/lib/chef/provider/windows_task.rb +1 -1
  21. data/lib/chef/resource/launchd.rb +4 -4
  22. data/lib/chef/resource/macos_userdefaults.rb +3 -3
  23. data/lib/chef/resource/msu_package.rb +1 -1
  24. data/lib/chef/resource/windows_firewall_rule.rb +2 -2
  25. data/lib/chef/resource/windows_package.rb +2 -2
  26. data/lib/chef/resource/windows_printer.rb +1 -1
  27. data/lib/chef/resource/windows_share.rb +2 -2
  28. data/lib/chef/resource/windows_task.rb +13 -13
  29. data/lib/chef/util/dsc/lcm_output_parser.rb +3 -3
  30. data/lib/chef/version.rb +1 -1
  31. data/lib/chef/win32/api/file.rb +18 -18
  32. data/lib/chef/win32/process.rb +2 -2
  33. data/spec/functional/resource/user/dscl_spec.rb +1 -1
  34. data/spec/functional/resource/user/mac_user_spec.rb +1 -1
  35. data/spec/support/shared/functional/file_resource.rb +1 -1
  36. data/spec/unit/knife/role_env_run_list_add_spec.rb +6 -6
  37. data/spec/unit/knife/role_env_run_list_clear_spec.rb +4 -4
  38. data/spec/unit/knife/role_env_run_list_remove_spec.rb +4 -4
  39. data/spec/unit/knife/role_env_run_list_replace_spec.rb +4 -4
  40. data/spec/unit/knife/role_env_run_list_set_spec.rb +4 -4
  41. data/spec/unit/knife/role_run_list_add_spec.rb +6 -6
  42. data/spec/unit/knife/role_run_list_clear_spec.rb +4 -4
  43. data/spec/unit/knife/role_run_list_remove_spec.rb +4 -4
  44. data/spec/unit/knife/role_run_list_replace_spec.rb +4 -4
  45. data/spec/unit/knife/role_run_list_set_spec.rb +4 -4
  46. data/spec/unit/provider/git_spec.rb +3 -3
  47. data/spec/unit/provider/launchd_spec.rb +8 -8
  48. data/spec/unit/provider/osx_profile_spec.rb +2 -2
  49. data/spec/unit/provider/package/msu_spec.rb +3 -3
  50. data/spec/unit/provider/service/gentoo_service_spec.rb +1 -1
  51. data/spec/unit/provider_resolver_spec.rb +9 -9
  52. data/spec/unit/resource/windows_package_spec.rb +10 -0
  53. data/spec/unit/run_context_spec.rb +1 -1
  54. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d68311a7ab5b1738bbd739ab5b89069da39f8fc8c639e1d261ac1d5836261bf8
4
- data.tar.gz: b5b5cac5dac1febf24cf947c70a868165d9c5dde49fad8a76128055e59b81f85
3
+ metadata.gz: dff34f7cf31ab5409ac6224e622e19f7120c6cd3956e3ca420d59c2d0ba22f99
4
+ data.tar.gz: 1c24c4c4c95f3d7d84be62e7fb3438e137f67d3f5d158e2326c474028cea2939
5
5
  SHA512:
6
- metadata.gz: 758923d89c1f5eadcaf35cfd262f303b6c19309c1ae5a4faa2a7c7d5d2646f0501e76ca00de6a64f02b1ac76fb1b8527e901ab71607bcbc8996992877b51f5de
7
- data.tar.gz: 200a93d8b87be3c3e46f764cd24b48414f46e118eb286b092beb7d3bd405905f1573437dd7c9597efb5e6d571876e2776a0f92f958dc966c8bb2c34c517fa130
6
+ metadata.gz: 680076ef15e74724a3ad4c36db87eeef298b5b3b1d78d4b7771f6f066c95d13e2d0563d865c74b4f7b007cdb3c35a5437c329c15d0672129523c354fce49b164
7
+ data.tar.gz: 0713c0072586807a4a7b9fa450122dc33ebdd1a86058fdda7084a3194e4de36aa4649740c0e3c5b2faad1088f6bcd3cb4d627c11b2cdf85bb81bbbb99e7a123d
data/Gemfile CHANGED
@@ -22,6 +22,9 @@ end
22
22
 
23
23
  gem "cheffish", ">= 14"
24
24
 
25
+ # avoid bringing in the new http 4 gem that comes with other ffi baggage which breaks builds
26
+ gem "chef-telemetry", "=1.0.3"
27
+
25
28
  group(:omnibus_package) do
26
29
  gem "appbundler"
27
30
  gem "rb-readline"
@@ -232,7 +232,7 @@ class Chef::Application::Apply < Chef::Application
232
232
  Chef::Application.fatal!("#{e.class}: #{e.message}", e)
233
233
  end
234
234
 
235
- # Get this party started
235
+ # Get this party started
236
236
  def run(enforce_license = false)
237
237
  reconfigure
238
238
  check_license_acceptance if enforce_license
@@ -139,8 +139,8 @@ class Chef
139
139
  def notify_on_deprecation(message)
140
140
  Chef.deprecated(:exit_code, message)
141
141
  rescue Chef::Exceptions::DeprecatedFeatureError
142
- # Have to rescue this, otherwise this unhandled error preempts
143
- # the current exit code assignment.
142
+ # Have to rescue this, otherwise this unhandled error preempts
143
+ # the current exit code assignment.
144
144
  end
145
145
 
146
146
  def non_standard_exit_code_warning(exit_code)
@@ -204,7 +204,7 @@ class Chef
204
204
  @memory_store.create(path, name, data, *options)
205
205
 
206
206
  elsif path[0] == "cookbooks" && path.length == 2
207
- # Do nothing. The entry gets created when the cookbook is created.
207
+ # Do nothing. The entry gets created when the cookbook is created.
208
208
 
209
209
  # /policy_groups/GROUP/policies/NAME
210
210
  elsif path[0] == "policy_groups" && path[2] == "policies"
@@ -724,8 +724,8 @@ class Chef
724
724
  path[-1] = "#{path[-1]}.json"
725
725
  end
726
726
 
727
- # /acls/containers|nodes|... do NOT drop into the next elsif, and do
728
- # not get .json appended
727
+ # /acls/containers|nodes|... do NOT drop into the next elsif, and do
728
+ # not get .json appended
729
729
 
730
730
  # /nodes|clients|.../x.json
731
731
  elsif path.length == 2
@@ -66,7 +66,7 @@ class Chef
66
66
  # }
67
67
  # }
68
68
  def children
69
- # Grab the names of the children, append json, and make child entries
69
+ # Grab the names of the children, append json, and make child entries
70
70
  @children ||= begin
71
71
  result = []
72
72
  data = root.get_json(api_path)
@@ -71,7 +71,7 @@ class Chef
71
71
  # Children are foo.json and bar.json in this case.
72
72
  #
73
73
  def children
74
- # Grab the names of the children, append json, and make child entries
74
+ # Grab the names of the children, append json, and make child entries
75
75
  @children ||= root.get_json(api_path).keys.sort.map do |key|
76
76
  make_child_entry(key, true)
77
77
  end
@@ -19,7 +19,7 @@ class Chef
19
19
  def children
20
20
  result = []
21
21
  seen = {}
22
- # If multiple things have the same name, the first one wins.
22
+ # If multiple things have the same name, the first one wins.
23
23
  multiplexed_dirs.each do |dir|
24
24
  dir.children.each do |child|
25
25
  if seen[child.name]
@@ -358,10 +358,10 @@ class Chef
358
358
 
359
359
  # extract the preference part from the path.
360
360
  if manifest_record_path =~ %r{(#{Regexp.escape(segment.to_s)}/[^/]+/#{Regexp.escape(dirname)})/.+$}
361
- # Note the specificy_dirname includes the segment and
362
- # dirname argument as above, which is what
363
- # preferences_for_path returns. It could be
364
- # "files/ubuntu-9.10/dirname", for example.
361
+ # Note the specificy_dirname includes the segment and
362
+ # dirname argument as above, which is what
363
+ # preferences_for_path returns. It could be
364
+ # "files/ubuntu-9.10/dirname", for example.
365
365
  specificity_dirname = $1
366
366
 
367
367
  # Record the specificity_dirname only if it's in the list of
@@ -72,7 +72,7 @@ class Chef
72
72
  # Just in case someone uses a symbol in the config by mistake.
73
73
  silence_spec = silence_spec.to_s
74
74
  end
75
- # Check for a silence by deprecation name, or by location.
75
+ # Check for a silence by deprecation name, or by location.
76
76
  self.class.deprecation_key == silence_spec || self.class.deprecation_id.to_s == silence_spec || "chef-#{self.class.deprecation_id}" == silence_spec.downcase || location.include?(silence_spec)
77
77
  end
78
78
  # check if this warning has been silenced by inline comment.
@@ -168,7 +168,7 @@ class Chef
168
168
  has_platform
169
169
  end
170
170
 
171
- # Implementation class for determining platform family dependent values
171
+ # Implementation class for determining platform family dependent values
172
172
  class PlatformFamilyDependentValue
173
173
 
174
174
  # Create a platform family dependent value object.
@@ -93,12 +93,12 @@ class Chef
93
93
  description: "For WinRM basic authentication when using the 'ssl' auth method.",
94
94
  boolean: true
95
95
 
96
- # This option was provided in knife bootstrap windows winrm,
97
- # but it is ignored in knife-windows/WinrmSession, and so remains unimplemeneted here.
98
- # option :kerberos_keytab_file,
99
- # :short => "-T KEYTAB_FILE",
100
- # :long => "--keytab-file KEYTAB_FILE",
101
- # :description => "The Kerberos keytab file used for authentication"
96
+ # This option was provided in knife bootstrap windows winrm,
97
+ # but it is ignored in knife-windows/WinrmSession, and so remains unimplemeneted here.
98
+ # option :kerberos_keytab_file,
99
+ # :short => "-T KEYTAB_FILE",
100
+ # :long => "--keytab-file KEYTAB_FILE",
101
+ # :description => "The Kerberos keytab file used for authentication"
102
102
 
103
103
  option :kerberos_realm,
104
104
  short: "-R KERBEROS_REALM",
@@ -20,14 +20,14 @@ require_relative "../knife"
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class UserInviteRecind < Chef::Knife
23
+ class UserInviteRescind < Chef::Knife
24
24
  category "user"
25
- banner "knife user invite recind [USERNAMES] (options)"
25
+ banner "knife user invite rescind [USERNAMES] (options)"
26
26
 
27
27
  option :all,
28
28
  short: "-a",
29
29
  long: "--all",
30
- description: "Recind all invites!"
30
+ description: "Rescind all invites!"
31
31
 
32
32
  def run
33
33
  if (name_args.length < 1) && ! config.key?(:all)
@@ -36,18 +36,18 @@ class Chef
36
36
  exit 1
37
37
  end
38
38
 
39
- # To recind we need to send a DELETE to association_requests/INVITE_ID
39
+ # To rescind we need to send a DELETE to association_requests/INVITE_ID
40
40
  # For user friendliness we look up the invite ID based on username.
41
41
  @invites = {}
42
42
  usernames = name_args
43
43
  rest.get_rest("association_requests").each { |i| @invites[i["username"]] = i["id"] }
44
44
  if config[:all]
45
- ui.confirm("Are you sure you want to recind all association requests")
45
+ ui.confirm("Are you sure you want to rescind all association requests")
46
46
  @invites.each do |u, i|
47
47
  rest.delete_rest("association_requests/#{i}")
48
48
  end
49
49
  else
50
- ui.confirm("Are you sure you want to recind the association requests for: #{usernames.join(", ")}")
50
+ ui.confirm("Are you sure you want to rescind the association requests for: #{usernames.join(", ")}")
51
51
  usernames.each do |u|
52
52
  if @invites.key?(u)
53
53
  rest.delete_rest("association_requests/#{@invites[u]}")
@@ -53,14 +53,14 @@ class Chef
53
53
  private
54
54
 
55
55
  def create_dir(path)
56
- # When doing multithreaded downloads into the file cache, the following
57
- # interleaving raises an error here:
58
- #
59
- # thread1 thread2
60
- # File.directory?(create_path) <- false
61
- # File.directory?(create_path) <- false
62
- # Dir.mkdir(create_path)
63
- # Dir.mkdir(create_path) <- raises Errno::EEXIST
56
+ # When doing multithreaded downloads into the file cache, the following
57
+ # interleaving raises an error here:
58
+ #
59
+ # thread1 thread2
60
+ # File.directory?(create_path) <- false
61
+ # File.directory?(create_path) <- false
62
+ # Dir.mkdir(create_path)
63
+ # Dir.mkdir(create_path) <- raises Errno::EEXIST
64
64
  Chef::Log.trace("Creating directory #{path}")
65
65
  Dir.mkdir(path)
66
66
  rescue Errno::EEXIST
@@ -340,6 +340,7 @@ class Chef
340
340
  # can also be overridden). Exclude has priority over include, although the caller is likely better
341
341
  # off doing the set arithmetic themselves for explicitness.
342
342
  #
343
+ # ```ruby
343
344
  # action :doit do
344
345
  # # use it inside a block
345
346
  # file "/etc/whatever.xyz" do
@@ -350,6 +351,7 @@ class Chef
350
351
  # r = declare_resource(:file, "etc/whatever.xyz")
351
352
  # r.copy_properties_from(new_resource, :owner, :group, :mode)
352
353
  # end
354
+ # ```
353
355
  #
354
356
  # @param other [Object] the other object (Chef::Resource) which implements the properties API
355
357
  # @param includes [Array<Symbol>] splat-args list of symbols of the properties to copy.
@@ -19,9 +19,9 @@ class Chef
19
19
  class Node
20
20
  module Mixin
21
21
  module DeepMergeCache
22
- # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the
23
- # top-level keys of the node object, and we save the computed deep-merge for that key here. There is
24
- # no cache of subtrees.
22
+ # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the
23
+ # top-level keys of the node object, and we save the computed deep-merge for that key here. There is
24
+ # no cache of subtrees.
25
25
  attr_accessor :deep_merge_cache
26
26
 
27
27
  def initialize
@@ -31,10 +31,10 @@ class Chef
31
31
  @deep_merge_cache = {}
32
32
  end
33
33
 
34
- # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
35
- # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']=
36
- # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call
37
- # must invalidate the entire cache and re-deep-merge the entire node object.
34
+ # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
35
+ # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']=
36
+ # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call
37
+ # must invalidate the entire cache and re-deep-merge the entire node object.
38
38
  def reset_cache(path = nil)
39
39
  if path.nil?
40
40
  deep_merge_cache.clear
@@ -36,7 +36,6 @@ class Chef
36
36
  label
37
37
  mode
38
38
  owner
39
- path
40
39
  source
41
40
  session_type
42
41
  type
@@ -44,7 +43,6 @@ class Chef
44
43
 
45
44
  def load_current_resource
46
45
  current_resource = Chef::Resource::Launchd.new(new_resource.name)
47
- @path = path ? path : gen_path_from_type
48
46
  end
49
47
 
50
48
  def gen_path_from_type
@@ -90,25 +88,16 @@ class Chef
90
88
 
91
89
  def manage_plist(action)
92
90
  if source
93
- cookbook_file @path do
94
- cookbook_name = cookbook if cookbook
95
- name(@path) if @path
96
- backup(backup) if backup
97
- group(group) if group
98
- mode(mode) if mode
99
- owner(owner) if owner
100
- source(source) if source
91
+ cookbook_file path do
92
+ cookbook_name = new_resource.cookbook if new_resource.cookbook
93
+ copy_properties_from(new_resource, :backup, :group, :mode, :owner, :source)
101
94
  action(action)
102
95
  only_if { manage_agent?(action) }
103
96
  end
104
97
  else
105
- file @path do
106
- name(@path) if @path
107
- backup(backup) if backup
108
- content(content) if content?
109
- group(group) if group
110
- mode(mode) if mode
111
- owner(owner) if owner
98
+ file path do
99
+ copy_properties_from(new_resource, :backup, :group, :mode, :owner)
100
+ content(file_content) if file_content?
112
101
  action(action)
113
102
  only_if { manage_agent?(action) }
114
103
  end
@@ -116,11 +105,11 @@ class Chef
116
105
  end
117
106
 
118
107
  def manage_service(action)
108
+ plist_path = path
119
109
  macosx_service label do
120
- name(label) if label
121
- service_name(label) if label
122
- plist(@path) if @path
123
- session_type(session_type) if session_type
110
+ service_name(new_resource.label) if new_resource.label
111
+ plist(plist_path) if plist_path
112
+ copy_properties_from(new_resource, :session_type)
124
113
  action(action)
125
114
  only_if { manage_agent?(action) }
126
115
  end
@@ -155,11 +144,11 @@ class Chef
155
144
  end
156
145
  end
157
146
 
158
- def content?
159
- !!content
147
+ def file_content?
148
+ !!file_content
160
149
  end
161
150
 
162
- def content
151
+ def file_content
163
152
  plist_hash = new_resource.plist_hash || gen_hash
164
153
  ::Plist::Emit.dump(plist_hash) unless plist_hash.nil?
165
154
  end
@@ -215,6 +204,11 @@ class Chef
215
204
  memo[val] = new_resource.send(key) if new_resource.send(key)
216
205
  end
217
206
  end
207
+
208
+ # @api private
209
+ def path
210
+ @path = new_resource.path ? new_resource.path : gen_path_from_type
211
+ end
218
212
  end
219
213
  end
220
214
  end
@@ -56,8 +56,10 @@ class Chef
56
56
  if @console_user
57
57
  @console_user = Etc.getpwuid(::File.stat("/dev/console").uid).name
58
58
  logger.trace("#{new_resource} console_user: '#{@console_user}'")
59
- cmd = "su -l"
60
- @base_user_cmd = cmd + "#{@console_user} -c"
59
+
60
+ @base_user_cmd = "su -l #{@console_user} -c"
61
+ logger.trace("#{new_resource} base_user_cmd: '#{@base_user_cmd}'")
62
+
61
63
  # Default LaunchAgent session should be Aqua
62
64
  @session_type = "Aqua" if @session_type.nil?
63
65
  end
@@ -117,9 +117,9 @@ class Chef
117
117
  logger.trace("#{@new_resource} is running")
118
118
  end
119
119
  rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
120
- # ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
121
- # Temporarily catching different types of exceptions here until we get Shellout fixed.
122
- # TODO: Remove the line before one we get the ShellOut fix.
120
+ # ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
121
+ # Temporarily catching different types of exceptions here until we get Shellout fixed.
122
+ # TODO: Remove the line before one we get the ShellOut fix.
123
123
  @status_load_success = false
124
124
  @current_resource.running false
125
125
  nil
@@ -424,7 +424,7 @@ class Chef
424
424
  when TaskScheduler::AT_LOGON
425
425
  # TODO: handle option for this trigger
426
426
  when TaskScheduler::AT_SYSTEMSTART
427
- # TODO: handle option for this trigger
427
+ # TODO: handle option for this trigger
428
428
  end
429
429
  end
430
430
 
@@ -76,20 +76,20 @@ class Chef
76
76
  property :start_calendar_interval, [Hash, Array],
77
77
  description: "A Hash (similar to crontab) that defines the calendar frequency at which a job is started or an Array.",
78
78
  coerce: proc { |type|
79
- # Coerce into an array of hashes to make validation easier
79
+ # Coerce into an array of hashes to make validation easier
80
80
  array = if type.is_a?(Array)
81
81
  type
82
82
  else
83
83
  [type]
84
84
  end
85
85
 
86
- # Check to make sure that our array only has hashes
86
+ # Check to make sure that our array only has hashes
87
87
  unless array.all? { |obj| obj.is_a?(Hash) }
88
88
  error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
89
89
  raise Chef::Exceptions::ValidationFailed, error_msg
90
90
  end
91
91
 
92
- # Make sure the hashes don't have any incorrect keys/values
92
+ # Make sure the hashes don't have any incorrect keys/values
93
93
  array.each do |entry|
94
94
  allowed_keys = %w{Minute Hour Day Weekday Month}
95
95
  unless entry.keys.all? { |key| allowed_keys.include?(key) }
@@ -105,7 +105,7 @@ class Chef
105
105
  end
106
106
  end
107
107
 
108
- # Don't return array if we only have one entry
108
+ # Don't return array if we only have one entry
109
109
  if array.size == 1
110
110
  array.first
111
111
  else
@@ -62,9 +62,9 @@ class Chef
62
62
  desired_state: false,
63
63
  skip_docs: true
64
64
 
65
- # coerce various ways of representing a boolean into either 0 (false) or 1 (true)
66
- # which is what the defaults CLI expects. Why? Well defaults itself accepts a few
67
- # different formats, but when you do a read command it all comes back as 1 or 0.
65
+ # coerce various ways of representing a boolean into either 0 (false) or 1 (true)
66
+ # which is what the defaults CLI expects. Why? Well defaults itself accepts a few
67
+ # different formats, but when you do a read command it all comes back as 1 or 0.
68
68
  def coerce_booleans(val)
69
69
  return 1 if [true, "TRUE", "1", "true", "YES", "yes"].include?(val)
70
70
  return 0 if [false, "FALSE", "0", "false", "NO", "no"].include?(val)
@@ -39,7 +39,7 @@ class Chef
39
39
 
40
40
  # This is the same property as the main package resource except it has the skip docs set to true
41
41
  # This resource abuses the package resource by storing the versions of all the cabs in the MSU file
42
- # in the version attribute from load current value even though those aren't technically the versio of the
42
+ # in the version attribute from load current value even though those aren't technically the version of the
43
43
  # msu. Since the user wouldn't actually set this we don't want it on the docs site.
44
44
  property :version, [String, Array],
45
45
  skip_docs: true,
@@ -93,7 +93,7 @@ class Chef
93
93
  description: "The local address the firewall rule applies to."
94
94
 
95
95
  property :local_port, [String, Integer, Array],
96
- # split various formats of comma separated lists and provide a sorted array of strings to match PS output
96
+ # split various formats of comma separated lists and provide a sorted array of strings to match PS output
97
97
  coerce: proc { |d| d.is_a?(String) ? d.split(/\s*,\s*/).sort : Array(d).sort.map(&:to_s) },
98
98
  description: "The local port the firewall rule applies to."
99
99
 
@@ -101,7 +101,7 @@ class Chef
101
101
  description: "The remote address the firewall rule applies to."
102
102
 
103
103
  property :remote_port, [String, Integer, Array],
104
- # split various formats of comma separated lists and provide a sorted array of strings to match PS output
104
+ # split various formats of comma separated lists and provide a sorted array of strings to match PS output
105
105
  coerce: proc { |d| d.is_a?(String) ? d.split(/\s*,\s*/).sort : Array(d).sort.map(&:to_s) },
106
106
  description: "The remote port the firewall rule applies to."
107
107
 
@@ -104,8 +104,8 @@ class Chef
104
104
  description: "An optional property to set the package name if it differs from the resource block's name.",
105
105
  identity: true
106
106
 
107
- property :version, String,
108
- description: "The version of a package to be installed or upgraded."
107
+ # we don't redefine the version property as a string here since we store the current value
108
+ # of version and that may be an array if multiple versions of a package are present on the system
109
109
 
110
110
  # windows can't take array options yet
111
111
  property :options, String,
@@ -62,7 +62,7 @@ class Chef
62
62
 
63
63
  property :driver_name, String,
64
64
  description: "The exact name of printer driver installed on the system.",
65
- required: true
65
+ required: [:create]
66
66
 
67
67
  property :location, String,
68
68
  description: "Printer location, such as `Fifth floor copy room`."
@@ -187,8 +187,8 @@ class Chef
187
187
  [f_users, c_users, r_users]
188
188
  end
189
189
 
190
- # local names are returned from Get-SmbShareAccess in the full format MACHINE\\NAME
191
- # but users of this resource would simply say NAME so we need to strip the values for comparison
190
+ # local names are returned from Get-SmbShareAccess in the full format MACHINE\\NAME
191
+ # but users of this resource would simply say NAME so we need to strip the values for comparison
192
192
  def stripped_account(name)
193
193
  name.slice!("#{node["hostname"]}\\")
194
194
  name
@@ -272,16 +272,16 @@ class Chef
272
272
 
273
273
  private
274
274
 
275
- ## Resource is not idempotent when day, start_day is not provided with frequency :weekly
276
- ## we set start_day when not given by user as current date based on which we set the day property for current current date day is monday ..
277
- ## we set the monday as the day so at next run when new_resource.day is nil and current_resource day is monday due to which udpate gets called
275
+ ## Resource is not idempotent when day, start_day is not provided with frequency :weekly
276
+ ## we set start_day when not given by user as current date based on which we set the day property for current current date day is monday ..
277
+ ## we set the monday as the day so at next run when new_resource.day is nil and current_resource day is monday due to which udpate gets called
278
278
  def idempotency_warning_for_frequency_weekly(day, start_day)
279
279
  if start_day.nil? && day.nil?
280
280
  logger.warn "To maintain idempotency for frequency :weekly provide start_day, start_time and day."
281
281
  end
282
282
  end
283
283
 
284
- # Validate the passed value is numeric values only if it is a string
284
+ # Validate the passed value is numeric values only if it is a string
285
285
  def numeric_value_in_string?(val)
286
286
  return true if Integer(val)
287
287
  rescue ArgumentError
@@ -307,7 +307,7 @@ class Chef
307
307
  end
308
308
  end
309
309
 
310
- # returns true if frequency_modifer has values First, second, third, fourth, last, lastday
310
+ # returns true if frequency_modifer has values First, second, third, fourth, last, lastday
311
311
  def frequency_modifier_includes_days_of_weeks?(frequency_modifier)
312
312
  frequency_modifier = frequency_modifier.to_s.split(",")
313
313
  frequency_modifier.map! { |value| value.strip.upcase }
@@ -322,7 +322,7 @@ class Chef
322
322
  raise ArgumentError, "Invalid value passed for `random_delay`. Please pass seconds as an Integer (e.g. 60) or a String with numeric values only (e.g. '60')." unless numeric_value_in_string?(random_delay)
323
323
  end
324
324
 
325
- # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~f
325
+ # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~f
326
326
  def validate_start_day(start_day, frequency)
327
327
  if start_day && frequency == :none
328
328
  raise ArgumentError, "`start_day` property is not supported with frequency: #{frequency}"
@@ -334,7 +334,7 @@ class Chef
334
334
  end
335
335
  end
336
336
 
337
- # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~
337
+ # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~
338
338
  def validate_start_time(start_time, frequency)
339
339
  if start_time
340
340
  raise ArgumentError, "`start_time` property is not supported with `frequency :none`" if frequency == :none
@@ -434,7 +434,7 @@ class Chef
434
434
  end
435
435
  end
436
436
 
437
- # This method returns true if day has values from 1-31 which is a days of moths and used with frequency :monthly
437
+ # This method returns true if day has values from 1-31 which is a days of moths and used with frequency :monthly
438
438
  def days_includes_days_of_months?(days)
439
439
  days.map! { |day| day.to_s.strip.downcase }
440
440
  (days - VALID_DAYS_OF_MONTH).empty?
@@ -452,11 +452,11 @@ class Chef
452
452
  end
453
453
  end
454
454
 
455
- # Converts the number of seconds to an ISO8601 duration format and returns it.
456
- # Ref : https://github.com/arnau/ISO8601/blob/master/lib/iso8601/duration.rb#L18-L23
457
- # e.g.
458
- # ISO8601::Duration.new(65707200).to_s
459
- # returns 'PT65707200S'
455
+ # Converts the number of seconds to an ISO8601 duration format and returns it.
456
+ # Ref : https://github.com/arnau/ISO8601/blob/master/lib/iso8601/duration.rb#L18-L23
457
+ # e.g.
458
+ # ISO8601::Duration.new(65707200).to_s
459
+ # returns 'PT65707200S'
460
460
  def sec_to_dur(seconds)
461
461
  ISO8601::Duration.new(seconds.to_i).to_s
462
462
  end
@@ -160,9 +160,9 @@ class Chef
160
160
 
161
161
  def self.parse_line(line)
162
162
  if match = line.match(/^.*?:.*?:\s*LCM:\s*\[(.*?)\](.*)/)
163
- # If the line looks like
164
- # What If: [machinename]: LCM: [op_action op_type] message
165
- # extract op_action, op_type, and message
163
+ # If the line looks like
164
+ # What If: [machinename]: LCM: [op_action op_type] message
165
+ # extract op_action, op_type, and message
166
166
  operation, info = match.captures
167
167
  op_action, op_type = operation.strip.split(" ").map { |m| m.downcase.to_sym }
168
168
  else
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("16.0.275")
26
+ VERSION = Chef::VersionString.new("16.0.287")
27
27
  end
28
28
 
29
29
  #
@@ -461,22 +461,22 @@ BOOL WINAPI DeviceIoControl(
461
461
  =end
462
462
  safe_attach_function :DeviceIoControl, %i{HANDLE DWORD LPVOID DWORD LPVOID DWORD LPDWORD pointer}, :BOOL
463
463
 
464
- # BOOL WINAPI DeleteVolumeMountPoint(
465
- # _In_ LPCTSTR lpszVolumeMountPoint
466
- # );
464
+ # BOOL WINAPI DeleteVolumeMountPoint(
465
+ # _In_ LPCTSTR lpszVolumeMountPoint
466
+ # );
467
467
  safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL
468
468
 
469
- # BOOL WINAPI SetVolumeMountPoint(
470
- # _In_ LPCTSTR lpszVolumeMountPoint,
471
- # _In_ LPCTSTR lpszVolumeName
472
- # );
469
+ # BOOL WINAPI SetVolumeMountPoint(
470
+ # _In_ LPCTSTR lpszVolumeMountPoint,
471
+ # _In_ LPCTSTR lpszVolumeName
472
+ # );
473
473
  safe_attach_function :SetVolumeMountPointW, %i{LPCTSTR LPCTSTR}, :BOOL
474
474
 
475
- # BOOL WINAPI GetVolumeNameForVolumeMountPoint(
476
- # _In_ LPCTSTR lpszVolumeMountPoint,
477
- # _Out_ LPTSTR lpszVolumeName,
478
- # _In_ DWORD cchBufferLength
479
- # );
475
+ # BOOL WINAPI GetVolumeNameForVolumeMountPoint(
476
+ # _In_ LPCTSTR lpszVolumeMountPoint,
477
+ # _Out_ LPTSTR lpszVolumeName,
478
+ # _In_ DWORD cchBufferLength
479
+ # );
480
480
  safe_attach_function :GetVolumeNameForVolumeMountPointW, %i{LPCTSTR LPTSTR DWORD}, :BOOL
481
481
 
482
482
  =begin
@@ -538,12 +538,12 @@ BOOL WINAPI VerQueryValue(
538
538
  # ensures the handle is closed on exit of the block
539
539
  # FIXME: yard with @yield
540
540
  def file_search_handle(path)
541
- # Workaround for CHEF-4419:
542
- # Make sure paths starting with "/" has a drive letter
543
- # assigned from the current working diretory.
544
- # Note: With CHEF-4427 this issue will be fixed with a
545
- # broader fix to map all the paths starting with "/" to
546
- # SYSTEM_DRIVE on windows.
541
+ # Workaround for CHEF-4419:
542
+ # Make sure paths starting with "/" has a drive letter
543
+ # assigned from the current working diretory.
544
+ # Note: With CHEF-4427 this issue will be fixed with a
545
+ # broader fix to map all the paths starting with "/" to
546
+ # SYSTEM_DRIVE on windows.
547
547
  path = ::File.expand_path(path) if path.start_with? "/"
548
548
  path = canonical_encode_path(path)
549
549
  find_data = WIN32_FIND_DATA.new
@@ -82,8 +82,8 @@ class Chef
82
82
  (call_succeeded != 0) && (is_64_bit_process_result.get_int(0) != 0)
83
83
  end
84
84
 
85
- # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights,
86
- # AND the PROCESS_VM_READ right
85
+ # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights,
86
+ # AND the PROCESS_VM_READ right
87
87
  def self.get_process_memory_info(handle)
88
88
  memory_info = PROCESS_MEMORY_COUNTERS.new
89
89
  unless GetProcessMemoryInfo(handle.handle, memory_info, memory_info.size)
@@ -29,7 +29,7 @@ describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metada
29
29
  def clean_user
30
30
  shell_out!("/usr/bin/dscl . -delete '/Users/#{username}'")
31
31
  rescue Mixlib::ShellOut::ShellCommandFailed
32
- # Raised when the user is already cleaned
32
+ # Raised when the user is already cleaned
33
33
  end
34
34
 
35
35
  def user_should_exist
@@ -29,7 +29,7 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
29
29
  def clean_user
30
30
  shell_out!("/usr/bin/dscl . -delete '/Users/#{username}'")
31
31
  rescue Mixlib::ShellOut::ShellCommandFailed
32
- # Raised when the user is already cleaned
32
+ # Raised when the user is already cleaned
33
33
  end
34
34
 
35
35
  def ensure_file_cache_path_exists
@@ -370,7 +370,7 @@ shared_examples_for "a configured file resource" do
370
370
  Chef::Config[:ssl_verify_mode] = :verify_none
371
371
  end
372
372
 
373
- # note the stripping of the drive letter from the tmpdir on windows
373
+ # note the stripping of the drive letter from the tmpdir on windows
374
374
  let(:backup_glob) { File.join(CHEF_SPEC_BACKUP_PATH, test_file_dir.sub(/^([A-Za-z]:)/, ""), "#{file_base}*") }
375
375
 
376
376
  # Most tests update the resource, but a few do not. We need to test that the
@@ -21,8 +21,8 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Knife::RoleEnvRunListAdd do
23
23
  before(:each) do
24
- # Chef::Config[:role_name] = "websimian"
25
- # Chef::Config[:env_name] = "QA"
24
+ # Chef::Config[:role_name] = "websimian"
25
+ # Chef::Config[:env_name] = "QA"
26
26
  @knife = Chef::Knife::RoleEnvRunListAdd.new
27
27
  @knife.config = {
28
28
  after: nil,
@@ -36,10 +36,10 @@ describe Chef::Knife::RoleEnvRunListAdd do
36
36
 
37
37
  describe "run" do
38
38
 
39
- # it "should display all the things" do
40
- # @knife.run
41
- # @role.to_json.should == 'show all the things'
42
- # end
39
+ # it "should display all the things" do
40
+ # @knife.run
41
+ # @role.to_json.should == 'show all the things'
42
+ # end
43
43
 
44
44
  it "should have an empty default run list" do
45
45
  @knife.run
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListClear do
44
44
 
45
45
  describe "run" do
46
46
 
47
- # it "should display all the things" do
48
- # @knife.run
49
- # @role.to_json.should == 'show all the things'
50
- # end
47
+ # it "should display all the things" do
48
+ # @knife.run
49
+ # @role.to_json.should == 'show all the things'
50
+ # end
51
51
 
52
52
  it "should load the node" do
53
53
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListRemove do
44
44
 
45
45
  describe "run" do
46
46
 
47
- # it "should display all the things" do
48
- # @knife.run
49
- # @role.to_json.should == 'show all the things'
50
- # end
47
+ # it "should display all the things" do
48
+ # @knife.run
49
+ # @role.to_json.should == 'show all the things'
50
+ # end
51
51
 
52
52
  it "should load the node" do
53
53
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListReplace do
44
44
 
45
45
  describe "run" do
46
46
 
47
- # it "should display all the things" do
48
- # @knife.run
49
- # @role.to_json.should == 'show all the things'
50
- # end
47
+ # it "should display all the things" do
48
+ # @knife.run
49
+ # @role.to_json.should == 'show all the things'
50
+ # end
51
51
 
52
52
  it "should load the node" do
53
53
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListSet do
44
44
 
45
45
  describe "run" do
46
46
 
47
- # it "should display all the things" do
48
- # @knife.run
49
- # @role.to_json.should == 'show all the things'
50
- # end
47
+ # it "should display all the things" do
48
+ # @knife.run
49
+ # @role.to_json.should == 'show all the things'
50
+ # end
51
51
 
52
52
  it "should load the node" do
53
53
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -21,8 +21,8 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Knife::RoleRunListAdd do
23
23
  before(:each) do
24
- # Chef::Config[:role_name] = "websimian"
25
- # Chef::Config[:env_name] = "QA"
24
+ # Chef::Config[:role_name] = "websimian"
25
+ # Chef::Config[:env_name] = "QA"
26
26
  @knife = Chef::Knife::RoleRunListAdd.new
27
27
  @knife.config = {
28
28
  after: nil,
@@ -36,10 +36,10 @@ describe Chef::Knife::RoleRunListAdd do
36
36
 
37
37
  describe "run" do
38
38
 
39
- # it "should display all the things" do
40
- # @knife.run
41
- # @role.to_json.should == 'show all the things'
42
- # end
39
+ # it "should display all the things" do
40
+ # @knife.run
41
+ # @role.to_json.should == 'show all the things'
42
+ # end
43
43
 
44
44
  it "should have a run list with the monkey role" do
45
45
  @knife.run
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListClear do
43
43
 
44
44
  describe "run" do
45
45
 
46
- # it "should display all the things" do
47
- # @knife.run
48
- # @role.to_json.should == 'show all the things'
49
- # end
46
+ # it "should display all the things" do
47
+ # @knife.run
48
+ # @role.to_json.should == 'show all the things'
49
+ # end
50
50
 
51
51
  it "should load the node" do
52
52
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListRemove do
43
43
 
44
44
  describe "run" do
45
45
 
46
- # it "should display all the things" do
47
- # @knife.run
48
- # @role.to_json.should == 'show all the things'
49
- # end
46
+ # it "should display all the things" do
47
+ # @knife.run
48
+ # @role.to_json.should == 'show all the things'
49
+ # end
50
50
 
51
51
  it "should load the node" do
52
52
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListReplace do
43
43
 
44
44
  describe "run" do
45
45
 
46
- # it "should display all the things" do
47
- # @knife.run
48
- # @role.to_json.should == 'show all the things'
49
- # end
46
+ # it "should display all the things" do
47
+ # @knife.run
48
+ # @role.to_json.should == 'show all the things'
49
+ # end
50
50
 
51
51
  it "should load the node" do
52
52
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListSet do
43
43
 
44
44
  describe "run" do
45
45
 
46
- # it "should display all the things" do
47
- # @knife.run
48
- # @role.to_json.should == 'show all the things'
49
- # end
46
+ # it "should display all the things" do
47
+ # @knife.run
48
+ # @role.to_json.should == 'show all the things'
49
+ # end
50
50
 
51
51
  it "should load the node" do
52
52
  expect(Chef::Role).to receive(:load).with("will").and_return(@role)
@@ -678,7 +678,7 @@ describe Chef::Provider::Git do
678
678
  expect(@provider).to receive(:enable_submodules)
679
679
  expect(@provider).to receive(:add_remotes)
680
680
  @provider.run_action(:checkout)
681
- # @resource.should be_updated
681
+ # @resource.should be_updated
682
682
  end
683
683
 
684
684
  it "should not checkout if the destination exists or is a non empty directory" do
@@ -716,7 +716,7 @@ describe Chef::Provider::Git do
716
716
  expect(@provider).to receive(:enable_submodules)
717
717
  expect(@provider).to receive(:add_remotes)
718
718
  @provider.run_action(:sync)
719
- # @resource.should be_updated
719
+ # @resource.should be_updated
720
720
  end
721
721
 
722
722
  it "does not fetch any updates if the remote revision matches the current revision" do
@@ -736,7 +736,7 @@ describe Chef::Provider::Git do
736
736
  expect(@provider).to receive(:action_checkout)
737
737
  expect(@provider).not_to receive(:shell_out!)
738
738
  @provider.run_action(:sync)
739
- # @resource.should be_updated
739
+ # @resource.should be_updated
740
740
  end
741
741
 
742
742
  it "clones the repo instead of fetching updates if the deploy directory is empty" do
@@ -131,8 +131,8 @@ describe Chef::Provider::Launchd do
131
131
  new_resource.program "/Library/scripts/call_mom.sh"
132
132
  new_resource.time_out 300
133
133
  new_resource.start_calendar_interval "Hour" => 10, "Weekday" => 7
134
- expect(provider.content?).to be_truthy
135
- expect(provider.content).to eql(test_plist)
134
+ expect(provider.file_content?).to be_truthy
135
+ expect(provider.file_content).to eql(test_plist)
136
136
  end
137
137
  end
138
138
 
@@ -147,8 +147,8 @@ describe Chef::Provider::Launchd do
147
147
  new_resource.program "/Library/scripts/call_mom.sh"
148
148
  new_resource.time_out 300
149
149
  new_resource.start_calendar_interval allowed
150
- expect(provider.content?).to be_truthy
151
- expect(provider.content).to eql(test_plist_multiple_intervals)
150
+ expect(provider.file_content?).to be_truthy
151
+ expect(provider.file_content).to eql(test_plist_multiple_intervals)
152
152
  end
153
153
 
154
154
  it "should allow all StartCalendarInterval keys" do
@@ -162,9 +162,9 @@ describe Chef::Provider::Launchd do
162
162
  new_resource.program "/Library/scripts/call_mom.sh"
163
163
  new_resource.time_out 300
164
164
  new_resource.start_calendar_interval allowed
165
- expect(provider.content?).to be_truthy
165
+ expect(provider.file_content?).to be_truthy
166
166
  %w{Minute Hour Day Weekday Month}.each do |key|
167
- expect(provider.content).to include("<key>#{key}</key>")
167
+ expect(provider.file_content).to include("<key>#{key}</key>")
168
168
  end
169
169
  end
170
170
 
@@ -188,8 +188,8 @@ describe Chef::Provider::Launchd do
188
188
  describe "hash is passed" do
189
189
  it "should produce the test_plist content from the plist_hash property" do
190
190
  new_resource.plist_hash test_hash
191
- expect(provider.content?).to be_truthy
192
- expect(provider.content).to eql(test_plist)
191
+ expect(provider.file_content?).to be_truthy
192
+ expect(provider.file_content).to eql(test_plist)
193
193
  end
194
194
  end
195
195
  end
@@ -61,8 +61,8 @@ describe Chef::Provider::OsxProfile do
61
61
  "ProfileVersion" => 1 }],
62
62
  }
63
63
  end
64
- # If anything is changed within this profile, be sure to update the
65
- # ProfileUUID in all_profiles to match the new config specific UUID
64
+ # If anything is changed within this profile, be sure to update the
65
+ # ProfileUUID in all_profiles to match the new config specific UUID
66
66
  let(:test_profile) do
67
67
  {
68
68
  "PayloadIdentifier" => "com.testprofile.screensaver",
@@ -261,9 +261,9 @@ describe Chef::Provider::Package::Msu, :windows_only do
261
261
  expect(cab_files).to eql(["msu_dir/IE10-Windows6.1-KB2859903-x86.CAB"])
262
262
  end
263
263
 
264
- # We couldn't find any msu file with multiple cab files in it.
265
- # So we are not 100% sure about the structure of XML file in this case
266
- # The specs below cover 2 possible XML formats
264
+ # We couldn't find any msu file with multiple cab files in it.
265
+ # So we are not 100% sure about the structure of XML file in this case
266
+ # The specs below cover 2 possible XML formats
267
267
  context "handles different xml formats for multiple cab files in the msu package" do
268
268
  it "parses xml file with multiple <package> tags" do
269
269
  xml_file = File.join(CHEF_SPEC_DATA, "sample_msu2.xml")
@@ -37,7 +37,7 @@ describe Chef::Provider::Service::Gentoo do
37
37
  allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
38
38
  allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
39
39
  end
40
- # new test: found_enabled state
40
+ # new test: found_enabled state
41
41
  #
42
42
  describe "load_current_resource" do
43
43
  it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do
@@ -593,14 +593,14 @@ describe Chef::ProviderResolver do
593
593
  "debian" => {
594
594
  ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Debian ],
595
595
  package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ],
596
- # service: [ Chef::Resource::DebianService, Chef::Provider::Service::Debian ],
596
+ # service: [ Chef::Resource::DebianService, Chef::Provider::Service::Debian ],
597
597
 
598
598
  "debian" => {
599
599
  "7.0" => {
600
600
  },
601
601
  "6.0" => {
602
602
  ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
603
- # service: [ Chef::Resource::InsservService, Chef::Provider::Service::Insserv ],
603
+ # service: [ Chef::Resource::InsservService, Chef::Provider::Service::Insserv ],
604
604
  },
605
605
  "5.0" => {
606
606
  ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
@@ -619,7 +619,7 @@ describe Chef::ProviderResolver do
619
619
  "linuxmint" => {
620
620
  "3.1.4" => {
621
621
  ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
622
- # service: [ Chef::Resource::UpstartService, Chef::Provider::Service::Upstart ],
622
+ # service: [ Chef::Resource::UpstartService, Chef::Provider::Service::Upstart ],
623
623
  },
624
624
  },
625
625
  "raspbian" => {
@@ -667,7 +667,7 @@ describe Chef::ProviderResolver do
667
667
  # TODO should be Chef::Resource::PortagePackage
668
668
  package: [ Chef::Resource::Package, Chef::Provider::Package::Portage ],
669
669
  portage_package: [ Chef::Resource::PortagePackage, Chef::Provider::Package::Portage ],
670
- # service: [ Chef::Resource::GentooService, Chef::Provider::Service::Gentoo ],
670
+ # service: [ Chef::Resource::GentooService, Chef::Provider::Service::Gentoo ],
671
671
 
672
672
  "gentoo" => {
673
673
  "3.1.4" => {
@@ -676,14 +676,14 @@ describe Chef::ProviderResolver do
676
676
  },
677
677
 
678
678
  "rhel" => {
679
- # service: [ Chef::Resource::SystemdService, Chef::Provider::Service::Systemd ],
679
+ # service: [ Chef::Resource::SystemdService, Chef::Provider::Service::Systemd ],
680
680
  package: [ Chef::Resource::DnfPackage, Chef::Provider::Package::Dnf ],
681
681
  ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Redhat ],
682
682
 
683
683
  %w{amazon xcp xenserver ibm_powerkvm cloudlinux parallels} => {
684
684
  "3.1.4" => {
685
685
  package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ],
686
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
686
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
687
687
  },
688
688
  },
689
689
  %w{redhat centos scientific oracle} => {
@@ -692,14 +692,14 @@ describe Chef::ProviderResolver do
692
692
  },
693
693
  "6.0" => {
694
694
  package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ],
695
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
695
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
696
696
  },
697
697
  },
698
698
  "fedora" => {
699
699
  "15.0" => {
700
700
  },
701
701
  "14.0" => {
702
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
702
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
703
703
  },
704
704
  },
705
705
  },
@@ -761,7 +761,7 @@ describe Chef::ProviderResolver do
761
761
  package: [ Chef::Resource::Package, Chef::Provider::Package::Bff ],
762
762
  rpm_package: [ Chef::Resource::RpmPackage, Chef::Provider::Package::Rpm ],
763
763
  user: [ Chef::Resource::User::AixUser, Chef::Provider::User::Aix ],
764
- # service: [ Chef::Resource::AixService, Chef::Provider::Service::Aix ],
764
+ # service: [ Chef::Resource::AixService, Chef::Provider::Service::Aix ],
765
765
 
766
766
  "aix" => {
767
767
  "aix" => {
@@ -93,6 +93,16 @@ describe Chef::Resource::WindowsPackage, "initialize" do
93
93
  expect(resource.returns).to eq([0, 3010])
94
94
  end
95
95
 
96
+ it "does not accept a string for the package_name property" do
97
+ expect { resource.package_name(%w{this should break}) }.to raise_error(Chef::Exceptions::ValidationFailed)
98
+ end
99
+
100
+ # even though we don't do anything with arrays of versions we need them for current_value
101
+ it "accepts both Strings and Arrays for the version property" do
102
+ expect { resource.version "1.2.3" }.not_to raise_error
103
+ expect { resource.version ["1.2.3", "1.2.3.4"] }.not_to raise_error
104
+ end
105
+
96
106
  it "defaults source to the resource name" do
97
107
  # it's a little late to stub out File.absolute_path
98
108
  expect(resource.source).to include("solitaire.msi")
@@ -138,7 +138,7 @@ describe Chef::RunContext do
138
138
  expect(node).to receive(:loaded_recipe).with(:ancient, "aliens")
139
139
  expect do
140
140
  run_context.include_recipe("ancient::aliens")
141
- # In CHEF-5120, this becomes a Chef::Exceptions::MissingCookbookDependency error:
141
+ # In CHEF-5120, this becomes a Chef::Exceptions::MissingCookbookDependency error:
142
142
  end.to raise_error(Chef::Exceptions::CookbookNotFound)
143
143
  end
144
144
 
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: 16.0.275
4
+ version: 16.0.287
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2020-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 16.0.275
19
+ version: 16.0.287
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: 16.0.275
26
+ version: 16.0.287
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 16.0.275
33
+ version: 16.0.287
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 16.0.275
40
+ version: 16.0.287
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -956,7 +956,7 @@ files:
956
956
  - lib/chef/knife/user_edit.rb
957
957
  - lib/chef/knife/user_invite_add.rb
958
958
  - lib/chef/knife/user_invite_list.rb
959
- - lib/chef/knife/user_invite_recind.rb
959
+ - lib/chef/knife/user_invite_rescind.rb
960
960
  - lib/chef/knife/user_key_create.rb
961
961
  - lib/chef/knife/user_key_delete.rb
962
962
  - lib/chef/knife/user_key_edit.rb