chef 14.5.33 → 14.6.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -3
  3. data/chef-universal-mingw32.gemspec +3 -2
  4. data/chef.gemspec +3 -4
  5. data/lib/chef/api_client.rb +5 -3
  6. data/lib/chef/api_client_v1.rb +6 -4
  7. data/lib/chef/application.rb +1 -1
  8. data/lib/chef/audit/audit_reporter.rb +1 -1
  9. data/lib/chef/audit/control_group_data.rb +12 -6
  10. data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -2
  11. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +1 -1
  12. data/lib/chef/cookbook/manifest_v0.rb +34 -29
  13. data/lib/chef/cookbook/manifest_v2.rb +15 -11
  14. data/lib/chef/cookbook/metadata.rb +4 -2
  15. data/lib/chef/cookbook_manifest.rb +8 -5
  16. data/lib/chef/cookbook_version.rb +1 -1
  17. data/lib/chef/data_bag.rb +4 -2
  18. data/lib/chef/data_bag_item.rb +5 -3
  19. data/lib/chef/data_collector.rb +2 -2
  20. data/lib/chef/data_collector/resource_report.rb +4 -4
  21. data/lib/chef/encrypted_data_bag_item.rb +4 -2
  22. data/lib/chef/environment.rb +4 -2
  23. data/lib/chef/file_content_management/deploy/mv_unix.rb +5 -4
  24. data/lib/chef/handler.rb +2 -2
  25. data/lib/chef/json_compat.rb +1 -1
  26. data/lib/chef/key.rb +7 -5
  27. data/lib/chef/knife/bootstrap.rb +7 -1
  28. data/lib/chef/knife/client_edit.rb +2 -2
  29. data/lib/chef/knife/data_bag_show.rb +2 -2
  30. data/lib/chef/knife/osc_user_edit.rb +2 -2
  31. data/lib/chef/knife/user_edit.rb +2 -2
  32. data/lib/chef/mixin/params_validate.rb +4 -2
  33. data/lib/chef/node/attribute.rb +4 -4
  34. data/lib/chef/org.rb +6 -4
  35. data/lib/chef/policy_builder/policyfile.rb +5 -3
  36. data/lib/chef/provider/package.rb +9 -4
  37. data/lib/chef/provider/package/windows.rb +23 -1
  38. data/lib/chef/provider/package/yum/yum_helper.py +3 -2
  39. data/lib/chef/provider/package/zypper.rb +12 -8
  40. data/lib/chef/provider/registry_key.rb +15 -6
  41. data/lib/chef/provider/user/windows.rb +4 -3
  42. data/lib/chef/provider/windows_task.rb +11 -2
  43. data/lib/chef/resource.rb +3 -1
  44. data/lib/chef/resource/locale.rb +1 -1
  45. data/lib/chef/resource/ohai_hint.rb +4 -4
  46. data/lib/chef/resource/rhsm_errata_level.rb +1 -1
  47. data/lib/chef/resource/timezone.rb +91 -0
  48. data/lib/chef/resource/user/windows_user.rb +4 -0
  49. data/lib/chef/resource/windows_task.rb +240 -238
  50. data/lib/chef/resource/zypper_package.rb +5 -0
  51. data/lib/chef/resource_collection/resource_collection_serialization.rb +4 -2
  52. data/lib/chef/resources.rb +1 -0
  53. data/lib/chef/role.rb +4 -2
  54. data/lib/chef/run_list/run_list_expansion.rb +5 -3
  55. data/lib/chef/run_status.rb +4 -2
  56. data/lib/chef/user.rb +7 -5
  57. data/lib/chef/user_v1.rb +8 -6
  58. data/lib/chef/version.rb +1 -1
  59. data/lib/chef/win32/security/sid.rb +39 -0
  60. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.aarch64.rpm +0 -0
  61. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.i686.rpm +0 -0
  62. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64.rpm +0 -0
  63. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64le.rpm +0 -0
  64. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.s390x.rpm +0 -0
  65. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.src.rpm +0 -0
  66. data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.x86_64.rpm +0 -0
  67. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.aarch64.rpm +0 -0
  68. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.i686.rpm +0 -0
  69. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64.rpm +0 -0
  70. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64le.rpm +0 -0
  71. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.s390x.rpm +0 -0
  72. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.src.rpm +0 -0
  73. data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.x86_64.rpm +0 -0
  74. data/spec/functional/http/simple_spec.rb +2 -2
  75. data/spec/functional/resource/remote_file_spec.rb +2 -2
  76. data/spec/functional/resource/user/windows_spec.rb +1 -1
  77. data/spec/functional/resource/windows_task_spec.rb +1 -1
  78. data/spec/functional/resource/zypper_package_spec.rb +233 -0
  79. data/spec/spec_helper.rb +1 -0
  80. data/spec/unit/audit/audit_reporter_spec.rb +4 -4
  81. data/spec/unit/audit/control_group_data_spec.rb +17 -17
  82. data/spec/unit/environment_spec.rb +1 -1
  83. data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +13 -1
  84. data/spec/unit/node_spec.rb +33 -0
  85. data/spec/unit/provider/package/rpm_spec.rb +5 -5
  86. data/spec/unit/provider/package/zypper_spec.rb +51 -0
  87. data/spec/unit/provider/package_spec.rb +32 -2
  88. data/spec/unit/provider/registry_key_spec.rb +74 -0
  89. data/spec/unit/provider/user/windows_spec.rb +12 -3
  90. data/spec/unit/provider/windows_task_spec.rb +1 -0
  91. data/spec/unit/resource/timezone.rb +39 -0
  92. data/spec/unit/resource/windows_task_spec.rb +1 -1
  93. data/spec/unit/resource_collection_spec.rb +1 -1
  94. data/spec/unit/run_context/child_run_context_spec.rb +3 -3
  95. data/spec/unit/shell/shell_session_spec.rb +3 -2
  96. metadata +21 -43
  97. data/CONTRIBUTING.md +0 -152
  98. data/VERSION +0 -1
  99. data/distro/powershell/chef/chef.psm1 +0 -459
  100. data/distro/ruby_bin_folder/Chef.PowerShell.Wrapper.dll +0 -0
  101. data/distro/ruby_bin_folder/Chef.PowerShell.dll +0 -0
  102. data/distro/ruby_bin_folder/Newtonsoft.Json.dll +0 -0
@@ -407,7 +407,7 @@ class Chef
407
407
  output["cookbook_name"] = name
408
408
  output["name"] = full_name
409
409
  output["frozen?"] = frozen_version?
410
- output["metadata"] = metadata.to_hash
410
+ output["metadata"] = metadata.to_h
411
411
  output["version"] = version
412
412
  output.merge(cookbook_manifest.by_parent_directory)
413
413
  end
@@ -58,7 +58,7 @@ class Chef
58
58
  )
59
59
  end
60
60
 
61
- def to_hash
61
+ def to_h
62
62
  result = {
63
63
  "name" => @name,
64
64
  "json_class" => self.class.name,
@@ -67,9 +67,11 @@ class Chef
67
67
  result
68
68
  end
69
69
 
70
+ alias_method :to_hash, :to_h
71
+
70
72
  # Serialize this object as a hash
71
73
  def to_json(*a)
72
- Chef::JSONCompat.to_json(to_hash, *a)
74
+ Chef::JSONCompat.to_json(to_h, *a)
73
75
  end
74
76
 
75
77
  def chef_server_rest
@@ -101,13 +101,15 @@ class Chef
101
101
  "data_bag_item_#{data_bag_name}_#{id}"
102
102
  end
103
103
 
104
- def to_hash
104
+ def to_h
105
105
  result = raw_data.dup
106
106
  result["chef_type"] = "data_bag_item"
107
107
  result["data_bag"] = data_bag.to_s
108
108
  result
109
109
  end
110
110
 
111
+ alias_method :to_hash, :to_h
112
+
111
113
  # Serialize this object as a hash
112
114
  def to_json(*a)
113
115
  result = {
@@ -180,9 +182,9 @@ class Chef
180
182
  end
181
183
 
182
184
  def ==(other)
183
- other.respond_to?(:to_hash) &&
185
+ other.respond_to?(:to_h) &&
184
186
  other.respond_to?(:data_bag) &&
185
- (other.to_hash == to_hash) &&
187
+ (other.to_h == to_h) &&
186
188
  (other.data_bag.to_s == data_bag.to_s)
187
189
  end
188
190
 
@@ -2,7 +2,7 @@
2
2
  # Author:: Adam Leff (<adamleff@chef.io>)
3
3
  # Author:: Ryan Cragun (<ryan@chef.io>)
4
4
  #
5
- # Copyright:: Copyright 2012-2017, Chef Software Inc.
5
+ # Copyright:: Copyright 2012-2018, Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -428,7 +428,7 @@ class Chef
428
428
  @all_resource_reports << OpenStruct.new(
429
429
  resource: resource_report.new_resource,
430
430
  action: resource_report.action,
431
- report_data: resource_report.to_hash
431
+ report_data: resource_report.to_h
432
432
  )
433
433
  end
434
434
 
@@ -2,7 +2,7 @@
2
2
  # Author:: Adam Leff (<adamleff@chef.io>)
3
3
  # Author:: Ryan Cragun (<ryan@chef.io>)
4
4
  #
5
- # Copyright:: Copyright 2012-2016, Chef Software Inc.
5
+ # Copyright:: Copyright 2012-2018, Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -65,7 +65,7 @@ class Chef
65
65
  %w{updated failed}.include?(status)
66
66
  end
67
67
 
68
- def to_hash
68
+ def to_h
69
69
  hash = {
70
70
  "type" => new_resource.resource_name.to_sym,
71
71
  "name" => new_resource.name.to_s,
@@ -90,8 +90,8 @@ class Chef
90
90
 
91
91
  hash
92
92
  end
93
- alias :to_h :to_hash
94
- alias :for_json :to_hash
93
+ alias_method :to_hash, :to_h
94
+ alias_method :for_json, :to_h
95
95
 
96
96
  # We should be able to call the identity of a resource safely, but there
97
97
  # is an edge case where resources that have a lazy property that is both
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Seth Falcon (<seth@chef.io>)
3
- # Copyright:: Copyright 2010-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2010-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -84,10 +84,12 @@ class Chef::EncryptedDataBagItem
84
84
  raise ArgumentError, "assignment not supported for #{self.class}"
85
85
  end
86
86
 
87
- def to_hash
87
+ def to_h
88
88
  @enc_hash.keys.inject({}) { |hash, key| hash[key] = self[key]; hash }
89
89
  end
90
90
 
91
+ alias_method :to_hash, :to_h
92
+
91
93
  def self.encrypt_data_bag_item(plain_hash, secret)
92
94
  plain_hash.inject({}) do |h, (key, val)|
93
95
  h[key] = if key != "id"
@@ -117,7 +117,7 @@ class Chef
117
117
  @cookbook_versions[cookbook] = version
118
118
  end
119
119
 
120
- def to_hash
120
+ def to_h
121
121
  result = {
122
122
  "name" => @name,
123
123
  "description" => @description,
@@ -130,8 +130,10 @@ class Chef
130
130
  result
131
131
  end
132
132
 
133
+ alias_method :to_hash, :to_h
134
+
133
135
  def to_json(*a)
134
- Chef::JSONCompat.to_json(to_hash, *a)
136
+ Chef::JSONCompat.to_json(to_h, *a)
135
137
  end
136
138
 
137
139
  def update_from!(o)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Lamont Granquist (<lamont@chef.io>)
3
- # Copyright:: Copyright 2013-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2013-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,9 +44,6 @@ class Chef
44
44
 
45
45
  Chef::Log.trace("Applying mode = #{mode.to_s(8)}, uid = #{uid}, gid = #{gid} to #{src}")
46
46
 
47
- # i own the inode, so should be able to at least chmod it
48
- ::File.chmod(mode, src)
49
-
50
47
  # we may be running as non-root in which case because we are doing an mv we cannot preserve
51
48
  # the file modes. after the mv we have a different inode and if we don't have rights to
52
49
  # chown/chgrp on the inode then we can't fix the ownership.
@@ -67,6 +64,10 @@ class Chef
67
64
  Chef::Log.warn("Could not set gid = #{gid} on #{src}, file modes not preserved")
68
65
  end
69
66
 
67
+ # i own the inode, so should be able to at least chmod it
68
+ # NOTE: this must come last due to POSIX stripping sticky mode bits on chown/chgrp
69
+ ::File.chmod(mode, src)
70
+
70
71
  Chef::Log.trace("Moving temporary file #{src} into place at #{dst}")
71
72
  FileUtils.mv(src, dst)
72
73
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
- # Copyright:: Copyright 2010-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2010-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -259,7 +259,7 @@ class Chef
259
259
 
260
260
  # Return the Hash representation of the run_status
261
261
  def data
262
- @run_status.to_hash
262
+ @run_status.to_h
263
263
  end
264
264
 
265
265
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Tim Hinderliter (<tim@chef.io>)
3
- # Copyright:: Copyright 2010-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2010-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -115,7 +115,7 @@ class Chef
115
115
  regex: /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z|infinity)$/)
116
116
  end
117
117
 
118
- def to_hash
118
+ def to_h
119
119
  result = {
120
120
  @actor_field_name => @actor,
121
121
  }
@@ -127,8 +127,10 @@ class Chef
127
127
  result
128
128
  end
129
129
 
130
+ alias_method :to_hash, :to_h
131
+
130
132
  def to_json(*a)
131
- Chef::JSONCompat.to_json(to_hash, *a)
133
+ Chef::JSONCompat.to_json(to_h, *a)
132
134
  end
133
135
 
134
136
  def create
@@ -155,7 +157,7 @@ class Chef
155
157
  result = chef_rest.post("#{api_base}/#{@actor}/keys", payload)
156
158
  # append the private key to the current key if the server returned one,
157
159
  # since the POST endpoint just returns uri and private_key if needed.
158
- new_key = to_hash
160
+ new_key = to_h
159
161
  new_key["private_key"] = result["private_key"] if result["private_key"]
160
162
  Chef::Key.from_hash(new_key)
161
163
  end
@@ -175,12 +177,12 @@ class Chef
175
177
  # to @name.
176
178
  put_name = @name if put_name.nil?
177
179
 
178
- new_key = chef_rest.put("#{api_base}/#{@actor}/keys/#{put_name}", to_hash)
180
+ new_key = chef_rest.put("#{api_base}/#{@actor}/keys/#{put_name}", to_h)
179
181
  # if the server returned a public_key, remove the create_key field, as we now have a key
180
182
  if new_key["public_key"]
181
183
  delete_create_key
182
184
  end
183
- Chef::Key.from_hash(to_hash.merge(new_key))
185
+ Chef::Key.from_hash(to_h.merge(new_key))
184
186
  end
185
187
 
186
188
  def save
@@ -409,7 +409,13 @@ class Chef
409
409
  end
410
410
  end
411
411
 
412
- # make sure policyfile values are set correctly
412
+ # Ensure options are valid by checking policyfile values.
413
+ #
414
+ # The method call will cause the program to exit(1) if:
415
+ # * Only one of --policy-name and --policy-group is specified
416
+ # * Policyfile options are set and --run-list is set as well
417
+ #
418
+ # @return [TrueClass] If options are valid.
413
419
  def validate_options!
414
420
  if incomplete_policyfile_options?
415
421
  ui.error("--policy-name and --policy-group must be specified together")
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
- # Copyright:: Copyright 2009-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2009-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,7 +37,7 @@ class Chef
37
37
  exit 1
38
38
  end
39
39
 
40
- original_data = Chef::ApiClientV1.load(@client_name).to_hash
40
+ original_data = Chef::ApiClientV1.load(@client_name).to_h
41
41
  edited_client = edit_hash(original_data)
42
42
  if original_data != edited_client
43
43
  client = Chef::ApiClientV1.from_hash(edited_client)
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Falcon (<seth@chef.io>)
4
- # Copyright:: Copyright 2009-2016, Chef Software, Inc.
4
+ # Copyright:: Copyright 2009-2018, Chef Software Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,7 +46,7 @@ class Chef
46
46
  raw = Chef::EncryptedDataBagItem.load(@name_args[0],
47
47
  @name_args[1],
48
48
  secret)
49
- format_for_display(raw.to_hash)
49
+ format_for_display(raw.to_h)
50
50
  elsif encrypted && !secret
51
51
  ui.warn("Encrypted data bag detected, but no secret provided for decoding. Displaying encrypted data.")
52
52
  format_for_display(raw_data)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Steven Danna (<steve@chef.io>)
3
- # Copyright:: Copyright 2012-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2012-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,7 +43,7 @@ class Chef
43
43
  exit 1
44
44
  end
45
45
 
46
- original_user = Chef::User.load(@user_name).to_hash
46
+ original_user = Chef::User.load(@user_name).to_h
47
47
  edited_user = edit_hash(original_user)
48
48
  if original_user != edited_user
49
49
  user = Chef::User.from_hash(edited_user)
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Steven Danna (<steve@chef.io>)
3
- # Copyright:: Copyright 2012-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2012-2018, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -57,7 +57,7 @@ EOF
57
57
  exit 1
58
58
  end
59
59
 
60
- original_user = Chef::UserV1.load(@user_name).to_hash
60
+ original_user = Chef::UserV1.load(@user_name).to_h
61
61
  # DEPRECATION NOTE
62
62
  # Remove this if statement and corrosponding code post OSC 11 support.
63
63
  #
@@ -174,7 +174,9 @@ class Chef
174
174
  to_be.each do |tb|
175
175
  return true if value == tb
176
176
  end
177
- raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.join(", ")}! You passed #{value.inspect}.")
177
+ # Ruby will print :something as something, which confuses users so make sure to print them as symbols
178
+ # by inspecting the value instead of just printing it
179
+ raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.map { |v| v.inspect }.join(", ")}! You passed #{value.inspect}.")
178
180
  end
179
181
  end
180
182
 
@@ -300,7 +302,7 @@ class Chef
300
302
  Array(regex).flatten.each do |r|
301
303
  return true if r.match(value.to_s)
302
304
  end
303
- raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key}'s value #{value} does not match regular expression #{regex.inspect}")
305
+ raise Exceptions::ValidationFailed, _validation_message(key, "Property #{key}'s value #{value} does not match regular expression #{regex.inspect}")
304
306
  end
305
307
  end
306
308
 
@@ -403,11 +403,11 @@ class Chef
403
403
  end
404
404
 
405
405
  def combined_override(*path)
406
- immutablize(merge_overrides(path))
406
+ merge_overrides(path)
407
407
  end
408
408
 
409
409
  def combined_default(*path)
410
- immutablize(merge_defaults(path))
410
+ merge_defaults(path)
411
411
  end
412
412
 
413
413
  def normal_unless(*args)
@@ -599,9 +599,9 @@ class Chef
599
599
  # In all other cases, replace merge_onto with merge_with
600
600
  else
601
601
  if merge_with.kind_of?(Hash)
602
- Chef::Node::VividMash.new(merge_with)
602
+ Chef::Node::ImmutableMash.new(merge_with)
603
603
  elsif merge_with.kind_of?(Array)
604
- Chef::Node::AttrArray.new(merge_with)
604
+ Chef::Node::ImmutableArray.new(merge_with)
605
605
  else
606
606
  merge_with
607
607
  end
@@ -58,7 +58,7 @@ class Chef
58
58
  arg, kind_of: String)
59
59
  end
60
60
 
61
- def to_hash
61
+ def to_h
62
62
  result = {
63
63
  "name" => @name,
64
64
  "full_name" => @full_name,
@@ -68,20 +68,22 @@ class Chef
68
68
  result
69
69
  end
70
70
 
71
+ alias_method :to_hash, :to_h
72
+
71
73
  def to_json(*a)
72
- Chef::JSONCompat.to_json(to_hash, *a)
74
+ Chef::JSONCompat.to_json(to_h, *a)
73
75
  end
74
76
 
75
77
  def create
76
78
  payload = { name: name, full_name: full_name }
77
79
  new_org = chef_rest.post("organizations", payload)
78
- Chef::Org.from_hash(to_hash.merge(new_org))
80
+ Chef::Org.from_hash(to_h.merge(new_org))
79
81
  end
80
82
 
81
83
  def update
82
84
  payload = { name: name, full_name: full_name }
83
85
  new_org = chef_rest.put("organizations/#{name}", payload)
84
- Chef::Org.from_hash(to_hash.merge(new_org))
86
+ Chef::Org.from_hash(to_h.merge(new_org))
85
87
  end
86
88
 
87
89
  def destroy
@@ -3,7 +3,7 @@
3
3
  # Author:: Tim Hinderliter (<tim@chef.io>)
4
4
  # Author:: Christopher Walters (<cw@chef.io>)
5
5
  # Author:: Daniel DeLeo (<dan@chef.io>)
6
- # Copyright:: Copyright 2008-2016 Chef Software, Inc.
6
+ # Copyright:: Copyright 2008-2018, Chef Software Inc.
7
7
  # License:: Apache License, Version 2.0
8
8
  #
9
9
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -56,7 +56,7 @@ class Chef
56
56
  # interface we need to properly send this through to
57
57
  # events.run_list_expanded as it is expecting a RunListExpansion
58
58
  # object.
59
- def to_hash
59
+ def to_h
60
60
  # It looks like version only gets populated in the expanded_run_list when
61
61
  # using a little used feature of roles to version lock cookbooks, so
62
62
  # version is not reliable in here anyway (places like Automate UI are
@@ -73,8 +73,10 @@ class Chef
73
73
  data_collector_hash
74
74
  end
75
75
 
76
+ alias_method :to_hash, :to_h
77
+
76
78
  def to_json(*opts)
77
- to_hash.to_json(*opts)
79
+ to_h.to_json(*opts)
78
80
  end
79
81
  end
80
82