chef 14.5.33 → 14.6.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -3
- data/chef-universal-mingw32.gemspec +3 -2
- data/chef.gemspec +3 -4
- data/lib/chef/api_client.rb +5 -3
- data/lib/chef/api_client_v1.rb +6 -4
- data/lib/chef/application.rb +1 -1
- data/lib/chef/audit/audit_reporter.rb +1 -1
- data/lib/chef/audit/control_group_data.rb +12 -6
- data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -2
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +1 -1
- data/lib/chef/cookbook/manifest_v0.rb +34 -29
- data/lib/chef/cookbook/manifest_v2.rb +15 -11
- data/lib/chef/cookbook/metadata.rb +4 -2
- data/lib/chef/cookbook_manifest.rb +8 -5
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/data_bag.rb +4 -2
- data/lib/chef/data_bag_item.rb +5 -3
- data/lib/chef/data_collector.rb +2 -2
- data/lib/chef/data_collector/resource_report.rb +4 -4
- data/lib/chef/encrypted_data_bag_item.rb +4 -2
- data/lib/chef/environment.rb +4 -2
- data/lib/chef/file_content_management/deploy/mv_unix.rb +5 -4
- data/lib/chef/handler.rb +2 -2
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/key.rb +7 -5
- data/lib/chef/knife/bootstrap.rb +7 -1
- data/lib/chef/knife/client_edit.rb +2 -2
- data/lib/chef/knife/data_bag_show.rb +2 -2
- data/lib/chef/knife/osc_user_edit.rb +2 -2
- data/lib/chef/knife/user_edit.rb +2 -2
- data/lib/chef/mixin/params_validate.rb +4 -2
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/org.rb +6 -4
- data/lib/chef/policy_builder/policyfile.rb +5 -3
- data/lib/chef/provider/package.rb +9 -4
- data/lib/chef/provider/package/windows.rb +23 -1
- data/lib/chef/provider/package/yum/yum_helper.py +3 -2
- data/lib/chef/provider/package/zypper.rb +12 -8
- data/lib/chef/provider/registry_key.rb +15 -6
- data/lib/chef/provider/user/windows.rb +4 -3
- data/lib/chef/provider/windows_task.rb +11 -2
- data/lib/chef/resource.rb +3 -1
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/ohai_hint.rb +4 -4
- data/lib/chef/resource/rhsm_errata_level.rb +1 -1
- data/lib/chef/resource/timezone.rb +91 -0
- data/lib/chef/resource/user/windows_user.rb +4 -0
- data/lib/chef/resource/windows_task.rb +240 -238
- data/lib/chef/resource/zypper_package.rb +5 -0
- data/lib/chef/resource_collection/resource_collection_serialization.rb +4 -2
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/role.rb +4 -2
- data/lib/chef/run_list/run_list_expansion.rb +5 -3
- data/lib/chef/run_status.rb +4 -2
- data/lib/chef/user.rb +7 -5
- data/lib/chef/user_v1.rb +8 -6
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/security/sid.rb +39 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.aarch64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.i686.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.s390x.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.src.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.x86_64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.aarch64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.i686.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.s390x.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.src.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.x86_64.rpm +0 -0
- data/spec/functional/http/simple_spec.rb +2 -2
- data/spec/functional/resource/remote_file_spec.rb +2 -2
- data/spec/functional/resource/user/windows_spec.rb +1 -1
- data/spec/functional/resource/windows_task_spec.rb +1 -1
- data/spec/functional/resource/zypper_package_spec.rb +233 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/audit/audit_reporter_spec.rb +4 -4
- data/spec/unit/audit/control_group_data_spec.rb +17 -17
- data/spec/unit/environment_spec.rb +1 -1
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +13 -1
- data/spec/unit/node_spec.rb +33 -0
- data/spec/unit/provider/package/rpm_spec.rb +5 -5
- data/spec/unit/provider/package/zypper_spec.rb +51 -0
- data/spec/unit/provider/package_spec.rb +32 -2
- data/spec/unit/provider/registry_key_spec.rb +74 -0
- data/spec/unit/provider/user/windows_spec.rb +12 -3
- data/spec/unit/provider/windows_task_spec.rb +1 -0
- data/spec/unit/resource/timezone.rb +39 -0
- data/spec/unit/resource/windows_task_spec.rb +1 -1
- data/spec/unit/resource_collection_spec.rb +1 -1
- data/spec/unit/run_context/child_run_context_spec.rb +3 -3
- data/spec/unit/shell/shell_session_spec.rb +3 -2
- metadata +21 -43
- data/CONTRIBUTING.md +0 -152
- data/VERSION +0 -1
- data/distro/powershell/chef/chef.psm1 +0 -459
- data/distro/ruby_bin_folder/Chef.PowerShell.Wrapper.dll +0 -0
- data/distro/ruby_bin_folder/Chef.PowerShell.dll +0 -0
- 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.
|
410
|
+
output["metadata"] = metadata.to_h
|
411
411
|
output["version"] = version
|
412
412
|
output.merge(cookbook_manifest.by_parent_directory)
|
413
413
|
end
|
data/lib/chef/data_bag.rb
CHANGED
@@ -58,7 +58,7 @@ class Chef
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
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(
|
74
|
+
Chef::JSONCompat.to_json(to_h, *a)
|
73
75
|
end
|
74
76
|
|
75
77
|
def chef_server_rest
|
data/lib/chef/data_bag_item.rb
CHANGED
@@ -101,13 +101,15 @@ class Chef
|
|
101
101
|
"data_bag_item_#{data_bag_name}_#{id}"
|
102
102
|
end
|
103
103
|
|
104
|
-
def
|
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?(:
|
185
|
+
other.respond_to?(:to_h) &&
|
184
186
|
other.respond_to?(:data_bag) &&
|
185
|
-
(other.
|
187
|
+
(other.to_h == to_h) &&
|
186
188
|
(other.data_bag.to_s == data_bag.to_s)
|
187
189
|
end
|
188
190
|
|
data/lib/chef/data_collector.rb
CHANGED
@@ -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-
|
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.
|
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-
|
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
|
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
|
-
|
94
|
-
|
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-
|
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
|
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"
|
data/lib/chef/environment.rb
CHANGED
@@ -117,7 +117,7 @@ class Chef
|
|
117
117
|
@cookbook_versions[cookbook] = version
|
118
118
|
end
|
119
119
|
|
120
|
-
def
|
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(
|
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-
|
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
|
data/lib/chef/handler.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2010-
|
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.
|
262
|
+
@run_status.to_h
|
263
263
|
end
|
264
264
|
|
265
265
|
end
|
data/lib/chef/json_compat.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Tim Hinderliter (<tim@chef.io>)
|
3
|
-
# Copyright:: Copyright 2010-
|
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");
|
data/lib/chef/key.rb
CHANGED
@@ -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
|
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(
|
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 =
|
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}",
|
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(
|
185
|
+
Chef::Key.from_hash(to_h.merge(new_key))
|
184
186
|
end
|
185
187
|
|
186
188
|
def save
|
data/lib/chef/knife/bootstrap.rb
CHANGED
@@ -409,7 +409,13 @@ class Chef
|
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
412
|
-
#
|
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-
|
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).
|
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-
|
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.
|
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-
|
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).
|
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)
|
data/lib/chef/knife/user_edit.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Steven Danna (<steve@chef.io>)
|
3
|
-
# Copyright:: Copyright 2012-
|
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).
|
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
|
-
|
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, "
|
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
|
|
data/lib/chef/node/attribute.rb
CHANGED
@@ -403,11 +403,11 @@ class Chef
|
|
403
403
|
end
|
404
404
|
|
405
405
|
def combined_override(*path)
|
406
|
-
|
406
|
+
merge_overrides(path)
|
407
407
|
end
|
408
408
|
|
409
409
|
def combined_default(*path)
|
410
|
-
|
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::
|
602
|
+
Chef::Node::ImmutableMash.new(merge_with)
|
603
603
|
elsif merge_with.kind_of?(Array)
|
604
|
-
Chef::Node::
|
604
|
+
Chef::Node::ImmutableArray.new(merge_with)
|
605
605
|
else
|
606
606
|
merge_with
|
607
607
|
end
|
data/lib/chef/org.rb
CHANGED
@@ -58,7 +58,7 @@ class Chef
|
|
58
58
|
arg, kind_of: String)
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
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(
|
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(
|
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(
|
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-
|
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
|
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
|
-
|
79
|
+
to_h.to_json(*opts)
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|