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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d51e830e9cccfff4ec27af2c3e3bd92e5ae45f0c43d2d4142b4663744d73d0
|
4
|
+
data.tar.gz: 07d9387a39d2e53d2b81120cebfa00276e74bcb583826605c3a16eede5773da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85186af3f82ce9835901e31b66b3f134a8a131a28bab7ea8fcd663f073c8a866e04062e891c2765c0f07197e02b7b412a89aafb4ea4607c705f35940603ec93e
|
7
|
+
data.tar.gz: 49d21188f23f5492bfce0dc2058d1abeb9daf87b12edb70de46dcc9809e25c6db345a5e1e5c5d5a67674922ca4323ece9573572c5c6d95311ab1926d32512fc5
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ gem "cheffish", "~> 14"
|
|
13
13
|
group(:omnibus_package) do
|
14
14
|
gem "appbundler"
|
15
15
|
gem "rb-readline"
|
16
|
-
gem "inspec-core", "~>
|
16
|
+
gem "inspec-core", "~> 3"
|
17
17
|
gem "chef-vault"
|
18
18
|
end
|
19
19
|
|
@@ -47,12 +47,14 @@ group(:ruby_shadow) do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
group(:development, :test) do
|
50
|
-
|
50
|
+
# we pin rake as a copy of rake is installed from the ruby source
|
51
|
+
# if you bump the ruby version you should confirm we don't end up with
|
52
|
+
# two rake gems installed again
|
53
|
+
gem "rake", "<= 12.3.0"
|
51
54
|
gem "simplecov"
|
52
55
|
gem "webmock"
|
53
56
|
|
54
57
|
# for testing new chefstyle rules
|
55
|
-
# gem 'chefstyle', github: 'chef/chefstyle'
|
56
58
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
|
57
59
|
end
|
58
60
|
|
@@ -14,9 +14,10 @@ gemspec.add_dependency "win32-process", "~> 0.8.2"
|
|
14
14
|
gemspec.add_dependency "win32-service", "~> 1.0"
|
15
15
|
gemspec.add_dependency "windows-api", "~> 0.4.4"
|
16
16
|
gemspec.add_dependency "wmi-lite", "~> 1.0"
|
17
|
-
gemspec.add_dependency "win32-taskscheduler", "~>
|
17
|
+
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
|
18
|
+
gemspec.add_dependency "iso8601", "~> 0.12.1"
|
18
19
|
gemspec.extensions << "ext/win32-eventlog/Rakefile"
|
19
|
-
gemspec.files +=
|
20
|
+
gemspec.files += Dir.glob("{distro,ext}/**/*")
|
20
21
|
|
21
22
|
gemspec.executables += %w{ chef-service-manager chef-windows-service }
|
22
23
|
|
data/chef.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = "chef"
|
6
6
|
s.version = Chef::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.extra_rdoc_files = ["README.md", "
|
8
|
+
s.extra_rdoc_files = ["README.md", "LICENSE" ]
|
9
9
|
s.summary = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure."
|
10
10
|
s.description = s.summary
|
11
11
|
s.license = "Apache-2.0"
|
@@ -38,10 +38,9 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_dependency "plist", "~> 3.2"
|
39
39
|
s.add_dependency "iniparse", "~> 1.4"
|
40
40
|
s.add_dependency "addressable"
|
41
|
-
s.add_dependency "iso8601", "~> 0.11.0"
|
42
41
|
|
43
42
|
# Audit mode requires these, so they are non-developmental dependencies now
|
44
|
-
%w{rspec-core rspec-expectations rspec-mocks}.each { |gem| s.add_dependency gem, "~> 3.5"
|
43
|
+
%w{rspec-core rspec-expectations rspec-mocks}.each { |gem| s.add_dependency gem, "~> 3.5" }
|
45
44
|
s.add_dependency "rspec_junit_formatter", "~> 0.2.0"
|
46
45
|
s.add_dependency "serverspec", "~> 2.7"
|
47
46
|
s.add_dependency "specinfra", "~> 2.10"
|
@@ -59,5 +58,5 @@ Gem::Specification.new do |s|
|
|
59
58
|
s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply chef-resource-inspector }
|
60
59
|
|
61
60
|
s.require_paths = %w{ lib }
|
62
|
-
s.files = %w{Gemfile Rakefile LICENSE README.md
|
61
|
+
s.files = %w{Gemfile Rakefile LICENSE README.md} + Dir.glob("{lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + Dir.glob("*.gemspec")
|
63
62
|
end
|
data/lib/chef/api_client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Nuo Yan (<nuo@chef.io>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-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");
|
@@ -110,7 +110,7 @@ class Chef
|
|
110
110
|
# Private key is included if available.
|
111
111
|
#
|
112
112
|
# @return [Hash]
|
113
|
-
def
|
113
|
+
def to_h
|
114
114
|
result = {
|
115
115
|
"name" => @name,
|
116
116
|
"public_key" => @public_key,
|
@@ -123,11 +123,13 @@ class Chef
|
|
123
123
|
result
|
124
124
|
end
|
125
125
|
|
126
|
+
alias_method :to_hash, :to_h
|
127
|
+
|
126
128
|
# The JSON representation of the object.
|
127
129
|
#
|
128
130
|
# @return [String] the JSON string.
|
129
131
|
def to_json(*a)
|
130
|
-
Chef::JSONCompat.to_json(
|
132
|
+
Chef::JSONCompat.to_json(to_h, *a)
|
131
133
|
end
|
132
134
|
|
133
135
|
def self.from_hash(o)
|
data/lib/chef/api_client_v1.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Nuo Yan (<nuo@chef.io>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-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");
|
@@ -146,7 +146,7 @@ class Chef
|
|
146
146
|
# Private key is included if available.
|
147
147
|
#
|
148
148
|
# @return [Hash]
|
149
|
-
def
|
149
|
+
def to_h
|
150
150
|
result = {
|
151
151
|
"name" => @name,
|
152
152
|
"validator" => @validator,
|
@@ -159,11 +159,13 @@ class Chef
|
|
159
159
|
result
|
160
160
|
end
|
161
161
|
|
162
|
+
alias_method :to_hash, :to_h
|
163
|
+
|
162
164
|
# The JSON representation of the object.
|
163
165
|
#
|
164
166
|
# @return [String] the JSON string.
|
165
167
|
def to_json(*a)
|
166
|
-
Chef::JSONCompat.to_json(
|
168
|
+
Chef::JSONCompat.to_json(to_h, *a)
|
167
169
|
end
|
168
170
|
|
169
171
|
def self.from_hash(o)
|
@@ -312,7 +314,7 @@ class Chef
|
|
312
314
|
|
313
315
|
new_client = chef_rest_v0.post("clients", payload)
|
314
316
|
end
|
315
|
-
Chef::ApiClientV1.from_hash(
|
317
|
+
Chef::ApiClientV1.from_hash(to_h.merge(new_client))
|
316
318
|
end
|
317
319
|
|
318
320
|
# As a string
|
data/lib/chef/application.rb
CHANGED
@@ -205,7 +205,7 @@ class Chef
|
|
205
205
|
# Based on config and whether or not STDOUT is a tty, should we setup a
|
206
206
|
# secondary logger for stdout?
|
207
207
|
def want_additional_logger?
|
208
|
-
|
208
|
+
( Chef::Config[:log_location].class != IO ) && STDOUT.tty? && !Chef::Config[:daemonize]
|
209
209
|
end
|
210
210
|
|
211
211
|
def configure_stdout_logger
|
@@ -118,7 +118,7 @@ class Chef
|
|
118
118
|
|
119
119
|
audit_history_url = "controls"
|
120
120
|
Chef::Log.trace("Sending audit report (run-id: #{audit_data.run_id})")
|
121
|
-
run_data = audit_data.
|
121
|
+
run_data = audit_data.to_h
|
122
122
|
|
123
123
|
if @audit_phase_error
|
124
124
|
error_info = "#{@audit_phase_error.class}: #{@audit_phase_error.message}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Tyler Ball (<tball@chef.io>)
|
3
3
|
#
|
4
|
-
# Copyright:: Copyright 2014-
|
4
|
+
# Copyright:: Copyright 2014-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");
|
@@ -35,15 +35,17 @@ class Chef
|
|
35
35
|
control_groups << control_group
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def to_h
|
39
39
|
{
|
40
40
|
node_name: node_name,
|
41
41
|
run_id: run_id,
|
42
42
|
start_time: start_time,
|
43
43
|
end_time: end_time,
|
44
|
-
control_groups: control_groups.collect { |c| c.
|
44
|
+
control_groups: control_groups.collect { |c| c.to_h },
|
45
45
|
}
|
46
46
|
end
|
47
|
+
|
48
|
+
alias_method :to_hash, :to_h
|
47
49
|
end
|
48
50
|
|
49
51
|
class ControlGroupData
|
@@ -76,7 +78,7 @@ class Chef
|
|
76
78
|
control
|
77
79
|
end
|
78
80
|
|
79
|
-
def
|
81
|
+
def to_h
|
80
82
|
# We sort it so the examples appear in the output in the same order
|
81
83
|
# they appeared in the recipe
|
82
84
|
controls.sort! { |x, y| x.line_number <=> y.line_number }
|
@@ -85,12 +87,14 @@ class Chef
|
|
85
87
|
status: status,
|
86
88
|
number_succeeded: number_succeeded,
|
87
89
|
number_failed: number_failed,
|
88
|
-
controls: controls.collect { |c| c.
|
90
|
+
controls: controls.collect { |c| c.to_h },
|
89
91
|
}
|
90
92
|
# If there is a duplicate key, metadata will overwrite it
|
91
93
|
add_display_only_data(h).merge(metadata)
|
92
94
|
end
|
93
95
|
|
96
|
+
alias_method :to_hash, :to_h
|
97
|
+
|
94
98
|
private
|
95
99
|
|
96
100
|
def create_control(control_data)
|
@@ -122,7 +126,7 @@ class Chef
|
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
125
|
-
def
|
129
|
+
def to_h
|
126
130
|
h = {
|
127
131
|
name: name,
|
128
132
|
status: status,
|
@@ -133,6 +137,8 @@ class Chef
|
|
133
137
|
h[:context] = context || []
|
134
138
|
h
|
135
139
|
end
|
140
|
+
|
141
|
+
alias_method :to_hash, :to_h
|
136
142
|
end
|
137
143
|
|
138
144
|
end
|
@@ -311,7 +311,7 @@ class Chef
|
|
311
311
|
cookbook_type = path[0]
|
312
312
|
result = nil
|
313
313
|
begin
|
314
|
-
result = Chef::CookbookManifest.new(entry.chef_object, policy_mode: cookbook_type == "cookbook_artifacts").
|
314
|
+
result = Chef::CookbookManifest.new(entry.chef_object, policy_mode: cookbook_type == "cookbook_artifacts").to_h
|
315
315
|
rescue Chef::ChefFS::FileSystem::NotFoundError => e
|
316
316
|
raise ChefZero::DataStore::DataNotFoundError.new(to_zero_path(e.entry), e)
|
317
317
|
end
|
@@ -334,7 +334,7 @@ class Chef
|
|
334
334
|
end
|
335
335
|
|
336
336
|
if cookbook_type == "cookbook_artifacts"
|
337
|
-
result["metadata"] = result["metadata"].
|
337
|
+
result["metadata"] = result["metadata"].to_h
|
338
338
|
result["metadata"].delete_if do |key, value|
|
339
339
|
value == [] ||
|
340
340
|
(value == {} && !%w{dependencies attributes recipes}.include?(key)) ||
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
2
|
-
# Copyright:: Copyright 2015-
|
2
|
+
# Copyright:: Copyright 2015-2018, Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,42 +26,47 @@ class Chef
|
|
26
26
|
|
27
27
|
COOKBOOK_SEGMENTS = %w{ resources providers recipes definitions libraries attributes files templates root_files }.freeze
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
class << self
|
30
|
+
|
31
|
+
def from_hash(hash)
|
32
|
+
response = Mash.new(hash)
|
33
|
+
response[:all_files] = COOKBOOK_SEGMENTS.inject([]) do |memo, segment|
|
34
|
+
next memo if hash[segment].nil? || hash[segment].empty?
|
35
|
+
hash[segment].each do |file|
|
36
|
+
file["name"] = "#{segment}/#{file["name"]}"
|
37
|
+
memo << file
|
38
|
+
end
|
39
|
+
response.delete(segment)
|
40
|
+
memo
|
36
41
|
end
|
37
|
-
response
|
38
|
-
memo
|
42
|
+
response
|
39
43
|
end
|
40
|
-
response
|
41
|
-
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
def to_h(manifest)
|
46
|
+
result = manifest.manifest.dup
|
47
|
+
result.delete("all_files")
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
files = manifest.by_parent_directory
|
50
|
+
files.keys.each_with_object(result) do |parent, memo|
|
51
|
+
if COOKBOOK_SEGMENTS.include?(parent)
|
52
|
+
memo[parent] ||= []
|
53
|
+
files[parent].each do |file|
|
54
|
+
file["name"] = file["name"].split("/")[1]
|
55
|
+
file.delete("full_path")
|
56
|
+
memo[parent] << file
|
57
|
+
end
|
55
58
|
end
|
56
59
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
# Ensure all segments are set to [] if they don't exist.
|
61
|
+
# See https://github.com/chef/chef/issues/6044
|
62
|
+
COOKBOOK_SEGMENTS.each do |segment|
|
63
|
+
result[segment] ||= []
|
64
|
+
end
|
65
|
+
|
66
|
+
result.merge({ "frozen?" => manifest.frozen_version?, "chef_type" => "cookbook_version" })
|
62
67
|
end
|
63
68
|
|
64
|
-
|
69
|
+
alias_method :to_hash, :to_h
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright 2015-
|
1
|
+
# Copyright:: Copyright 2015-2018, Chef Software Inc.
|
2
2
|
# License:: Apache License, Version 2.0
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,17 +23,21 @@ class Chef
|
|
23
23
|
|
24
24
|
minimum_api_version 2
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
class << self
|
27
|
+
def from_hash(hash)
|
28
|
+
Chef::Log.trace "processing manifest: #{hash}"
|
29
|
+
Mash.new hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_h(manifest)
|
33
|
+
result = manifest.manifest.dup
|
34
|
+
result["all_files"].map! { |file| file.delete("full_path"); file }
|
35
|
+
result["frozen?"] = manifest.frozen_version?
|
36
|
+
result["chef_type"] = "cookbook_version"
|
37
|
+
result.to_hash
|
38
|
+
end
|
30
39
|
|
31
|
-
|
32
|
-
result = manifest.manifest.dup
|
33
|
-
result["all_files"].map! { |file| file.delete("full_path"); file }
|
34
|
-
result["frozen?"] = manifest.frozen_version?
|
35
|
-
result["chef_type"] = "cookbook_version"
|
36
|
-
result.to_hash
|
40
|
+
alias_method :to_hash, :to_h
|
37
41
|
end
|
38
42
|
|
39
43
|
end
|
@@ -465,7 +465,7 @@ class Chef
|
|
465
465
|
end
|
466
466
|
end
|
467
467
|
|
468
|
-
def
|
468
|
+
def to_h
|
469
469
|
{
|
470
470
|
NAME => name,
|
471
471
|
DESCRIPTION => description,
|
@@ -488,8 +488,10 @@ class Chef
|
|
488
488
|
}
|
489
489
|
end
|
490
490
|
|
491
|
+
alias_method :to_hash, :to_h
|
492
|
+
|
491
493
|
def to_json(*a)
|
492
|
-
Chef::JSONCompat.to_json(
|
494
|
+
Chef::JSONCompat.to_json(to_h, *a)
|
493
495
|
end
|
494
496
|
|
495
497
|
def self.from_hash(o)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
2
|
-
# Copyright:: Copyright 2015-
|
2
|
+
# Copyright:: Copyright 2015-2018, Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -40,7 +40,7 @@ class Chef
|
|
40
40
|
def_delegator :@cookbook_version, :frozen_version?
|
41
41
|
|
42
42
|
# Create a new CookbookManifest object for the given `cookbook_version`.
|
43
|
-
# You can subsequently call #
|
43
|
+
# You can subsequently call #to_h to get a Hash representation of the
|
44
44
|
# cookbook_version in the "manifest" format, or #to_json to get a JSON
|
45
45
|
# representation of the cookbook_version.
|
46
46
|
#
|
@@ -119,12 +119,14 @@ class Chef
|
|
119
119
|
@policy_mode
|
120
120
|
end
|
121
121
|
|
122
|
-
def
|
123
|
-
CookbookManifestVersions.
|
122
|
+
def to_h
|
123
|
+
CookbookManifestVersions.to_h(self)
|
124
124
|
end
|
125
125
|
|
126
|
+
alias_method :to_hash, :to_h
|
127
|
+
|
126
128
|
def to_json(*a)
|
127
|
-
result =
|
129
|
+
result = to_h
|
128
130
|
result["json_class"] = "Chef::CookbookVersion"
|
129
131
|
Chef::JSONCompat.to_json(result, *a)
|
130
132
|
end
|
@@ -321,5 +323,6 @@ class Chef
|
|
321
323
|
|
322
324
|
def_versioned_delegator :from_hash
|
323
325
|
def_versioned_delegator :to_hash
|
326
|
+
def_versioned_delegator :to_h
|
324
327
|
end
|
325
328
|
end
|