chef 18.0.169 → 18.0.185
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef.gemspec +2 -2
- data/lib/chef/mixin/checksum.rb +6 -0
- data/lib/chef/provider/cron.rb +5 -1
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/package/snap.rb +1 -1
- data/lib/chef/provider/package/windows.rb +1 -1
- data/lib/chef/resource/apt_package.rb +2 -0
- data/lib/chef/resource/chef_client_config.rb +2 -2
- data/lib/chef/resource/dmg_package.rb +2 -0
- data/lib/chef/resource/freebsd_package.rb +2 -0
- data/lib/chef/resource/gem_package.rb +2 -0
- data/lib/chef/resource/homebrew_package.rb +2 -0
- data/lib/chef/resource/macports_package.rb +2 -0
- data/lib/chef/resource/openbsd_package.rb +2 -0
- data/lib/chef/resource/pacman_package.rb +2 -0
- data/lib/chef/resource/portage_package.rb +2 -0
- data/lib/chef/resource/rpm_package.rb +2 -0
- data/lib/chef/resource/smartos_package.rb +2 -0
- data/lib/chef/resource/snap_package.rb +2 -0
- data/lib/chef/resource/solaris_package.rb +2 -0
- data/lib/chef/resource/windows_package.rb +3 -3
- data/lib/chef/resource/yum_package.rb +2 -0
- data/lib/chef/resource/zypper_package.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/unit/mixin/checksum_spec.rb +28 -0
- data/spec/unit/provider/cron_spec.rb +36 -0
- metadata +8 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e26d247c5f5a3d647c5fab3090148d07e5714d73f5b51e79ac836ef4abfb8cb
|
4
|
+
data.tar.gz: f31e1d3a651490f209276bf1583310940eaa67391d6879c50704504bdfdfe928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 860f0b162f5ebbd6d8e40383aeb682df596dc0ac09207d5bb5be807ff5de0359e50f22f603a94e385b95b1c03cf87286c056dfc160a523ced7e6902960ae5b7c
|
7
|
+
data.tar.gz: 8e3c3dc548d6cabd651adb17a150a91dec76c09d1d93a2b3e9561d0ff3abf69ad9301b4368901a1dc2015241cec589da5861a3642e70ce05f0356bd045e10c86
|
data/chef.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
|
31
31
|
s.add_dependency "chef-config", "= #{Chef::VERSION}"
|
32
32
|
s.add_dependency "chef-utils", "= #{Chef::VERSION}"
|
33
|
-
s.add_dependency "train-core", "~> 3.10"
|
33
|
+
s.add_dependency "train-core", "~> 3.10" # 3.2.28 fixes sudo prompts. See https://github.com/chef/chef/pull/9635
|
34
34
|
s.add_dependency "train-winrm", ">= 0.2.5"
|
35
35
|
s.add_dependency "train-rest", ">= 0.4.1" # target mode with rest APIs
|
36
36
|
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
|
46
46
|
s.add_dependency "ffi", ">= 1.15.5"
|
47
47
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
48
|
-
s.add_dependency "net-sftp", ">= 2.1.2", "<
|
48
|
+
s.add_dependency "net-sftp", ">= 2.1.2", "< 5.0" # remote_file resource
|
49
49
|
s.add_dependency "net-ftp" # remote_file resource
|
50
50
|
s.add_dependency "erubis", "~> 2.7" # template resource / cookbook syntax check
|
51
51
|
s.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
|
data/lib/chef/mixin/checksum.rb
CHANGED
data/lib/chef/provider/cron.rb
CHANGED
@@ -88,7 +88,11 @@ class Chef
|
|
88
88
|
|
89
89
|
def cron_different?
|
90
90
|
CRON_ATTRIBUTES.any? do |cron_var|
|
91
|
-
new_resource.send(cron_var)
|
91
|
+
if new_resource.send(cron_var).class == current_resource.send(cron_var).class
|
92
|
+
new_resource.send(cron_var) != current_resource.send(cron_var)
|
93
|
+
else
|
94
|
+
new_resource.send(cron_var).to_s != current_resource.send(cron_var).to_s
|
95
|
+
end
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
data/lib/chef/provider/file.rb
CHANGED
@@ -336,7 +336,7 @@ class Chef
|
|
336
336
|
end
|
337
337
|
|
338
338
|
def do_validate_content
|
339
|
-
if new_resource.checksum && tempfile && (
|
339
|
+
if new_resource.checksum && tempfile && !checksum_match?(new_resource.checksum, tempfile_checksum)
|
340
340
|
raise Chef::Exceptions::ChecksumMismatch.new(short_cksum(new_resource.checksum), short_cksum(tempfile_checksum))
|
341
341
|
end
|
342
342
|
|
@@ -450,7 +450,7 @@ class Chef
|
|
450
450
|
|
451
451
|
def contents_changed?
|
452
452
|
logger.trace "calculating checksum of #{tempfile.path} to compare with #{current_resource.checksum}"
|
453
|
-
tempfile_checksum
|
453
|
+
!checksum_match?(tempfile_checksum, current_resource.checksum)
|
454
454
|
end
|
455
455
|
|
456
456
|
def tempfile
|
@@ -38,7 +38,7 @@ class Chef
|
|
38
38
|
def define_resource_requirements
|
39
39
|
if new_resource.checksum
|
40
40
|
requirements.assert(:install) do |a|
|
41
|
-
a.assertion { new_resource.checksum
|
41
|
+
a.assertion { checksum_match?(new_resource.checksum, checksum(source_location)) }
|
42
42
|
a.failure_message Chef::Exceptions::Package, "Checksum on resource (#{short_cksum(new_resource.checksum)}) does not match checksum on content (#{short_cksum(source_location)})"
|
43
43
|
end
|
44
44
|
end
|
@@ -56,6 +56,8 @@ class Chef
|
|
56
56
|
|
57
57
|
description "Use the **apt_package** resource to manage packages on Debian, Ubuntu, and other platforms that use the APT package system."
|
58
58
|
|
59
|
+
allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock
|
60
|
+
|
59
61
|
property :default_release, String,
|
60
62
|
description: "The default release. For example: `stable`.",
|
61
63
|
desired_state: false
|
@@ -255,7 +255,7 @@ class Chef
|
|
255
255
|
action :create, description: "Create a client.rb config file and folders for configuring #{ChefUtils::Dist::Infra::PRODUCT}." do
|
256
256
|
[
|
257
257
|
new_resource.config_directory,
|
258
|
-
(::File.dirname(new_resource.log_location)
|
258
|
+
(::File.dirname(new_resource.log_location) if new_resource.log_location.is_a?(String) && !%w{STDOUT STDERR}.include?(new_resource.log_location) && !new_resource.log_location.empty?),
|
259
259
|
new_resource.file_backup_path,
|
260
260
|
new_resource.file_cache_path,
|
261
261
|
::File.join(new_resource.config_directory, "client.d"),
|
@@ -265,7 +265,7 @@ class Chef
|
|
265
265
|
directory dir_path do
|
266
266
|
user new_resource.user unless new_resource.user.nil?
|
267
267
|
group new_resource.group unless new_resource.group.nil?
|
268
|
-
mode dir_path == ::File.dirname(new_resource.log_location) ? "0755" : "0750"
|
268
|
+
mode dir_path == ::File.dirname(new_resource.log_location.to_s) ? "0755" : "0750"
|
269
269
|
recursive true
|
270
270
|
end
|
271
271
|
end
|
@@ -30,6 +30,8 @@ class Chef
|
|
30
30
|
|
31
31
|
description "Use the **freebsd_package** resource to manage packages for the FreeBSD platform."
|
32
32
|
|
33
|
+
allowed_actions :install, :remove
|
34
|
+
|
33
35
|
# make sure we assign the appropriate underlying providers based on what
|
34
36
|
# package managers exist on this FreeBSD system or the source of the package
|
35
37
|
#
|
@@ -60,6 +60,8 @@ class Chef
|
|
60
60
|
```
|
61
61
|
DOC
|
62
62
|
|
63
|
+
allowed_actions :install, :upgrade, :remove, :purge
|
64
|
+
|
63
65
|
property :homebrew_user, [ String, Integer ],
|
64
66
|
description: "The name or uid of the Homebrew owner to be used by #{ChefUtils::Dist::Infra::PRODUCT} when executing a command.\n\n#{ChefUtils::Dist::Infra::PRODUCT}, by default, will attempt to execute a Homebrew command as the owner of the `/usr/local/bin/brew` executable. If that executable does not exist, #{ChefUtils::Dist::Infra::PRODUCT} will attempt to find the user by executing `which brew`. If that executable cannot be found, #{ChefUtils::Dist::Infra::PRODUCT} will print an error message: `Could not find the 'brew' executable in /usr/local/bin or anywhere on the path.`.\n\nSet this property to specify the Homebrew owner for situations where Chef Infra Client cannot automatically detect the correct owner.'"
|
65
67
|
|
@@ -25,6 +25,8 @@ class Chef
|
|
25
25
|
|
26
26
|
description "Use the **macports_package** resource to manage packages for the macOS platform using the MacPorts package management system."
|
27
27
|
|
28
|
+
allowed_actions :install, :upgrade, :remove, :purge
|
29
|
+
|
28
30
|
property :package_name, String,
|
29
31
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
30
32
|
identity: true
|
@@ -26,6 +26,8 @@ class Chef
|
|
26
26
|
|
27
27
|
description "Use the **portage_package** resource to manage packages for the Gentoo platform."
|
28
28
|
|
29
|
+
allowed_actions :install, :upgrade, :remove, :purge
|
30
|
+
|
29
31
|
property :package_name, String,
|
30
32
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
31
33
|
identity: true
|
@@ -27,6 +27,8 @@ class Chef
|
|
27
27
|
|
28
28
|
description "Use the **smartos_package** resource to manage packages for the SmartOS platform."
|
29
29
|
|
30
|
+
allowed_actions :install, :upgrade, :remove
|
31
|
+
|
30
32
|
property :package_name, String,
|
31
33
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
32
34
|
identity: true
|
@@ -27,6 +27,8 @@ class Chef
|
|
27
27
|
description "Use the **snap_package** resource to manage snap packages on Debian and Ubuntu platforms."
|
28
28
|
introduced "15.0"
|
29
29
|
|
30
|
+
allowed_actions :install, :upgrade, :remove, :purge
|
31
|
+
|
30
32
|
property :channel, String,
|
31
33
|
description: "The default channel. For example: stable.",
|
32
34
|
default: "stable",
|
@@ -27,6 +27,8 @@ class Chef
|
|
27
27
|
|
28
28
|
description "Use the **solaris_package** resource to manage packages on the Solaris platform."
|
29
29
|
|
30
|
+
allowed_actions :install, :upgrade, :remove
|
31
|
+
|
30
32
|
property :package_name, String,
|
31
33
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
32
34
|
identity: true
|
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
```ruby
|
79
79
|
windows_package '7zip' do
|
80
80
|
source 'http://www.7-zip.org/a/7z938-x64.msi'
|
81
|
-
checksum '
|
81
|
+
checksum '7c8e873991c82ad9cfcdbdf45254ea6101e9a645e12977dcd518979e50fdedf3'
|
82
82
|
end
|
83
83
|
```
|
84
84
|
|
@@ -91,7 +91,7 @@ class Chef
|
|
91
91
|
source 'http://www.7-zip.org/a/7z938-x64.msi'
|
92
92
|
remote_file_attributes ({
|
93
93
|
:path => 'C:\\7zip.msi',
|
94
|
-
:checksum => '
|
94
|
+
:checksum => '7c8e873991c82ad9cfcdbdf45254ea6101e9a645e12977dcd518979e50fdedf3'
|
95
95
|
})
|
96
96
|
end
|
97
97
|
```
|
@@ -100,7 +100,7 @@ class Chef
|
|
100
100
|
|
101
101
|
```ruby
|
102
102
|
windows_package 'Mercurial 3.6.1 (64-bit)' do
|
103
|
-
source '
|
103
|
+
source 'https://www.mercurial-scm.org/release/windows/Mercurial-3.6.1-x64.exe'
|
104
104
|
checksum 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d'
|
105
105
|
end
|
106
106
|
```
|
@@ -109,6 +109,8 @@ class Chef
|
|
109
109
|
```
|
110
110
|
DOC
|
111
111
|
|
112
|
+
allowed_actions :install, :upgrade, :remove, :purge, :lock, :unlock
|
113
|
+
|
112
114
|
# XXX: the coercions here are due to the provider promiscuously updating the properties on the
|
113
115
|
# new_resource which causes immutable modification exceptions when passed an immutable node array.
|
114
116
|
#
|
@@ -53,6 +53,8 @@ class Chef
|
|
53
53
|
```
|
54
54
|
DOC
|
55
55
|
|
56
|
+
allowed_actions :install, :upgrade, :remove, :purge, :lock, :unlock
|
57
|
+
|
56
58
|
property :gpg_check, [ TrueClass, FalseClass ],
|
57
59
|
description: "Verify the package's GPG signature. Can also be controlled site-wide using the `zypper_check_gpg` config option.",
|
58
60
|
default: lazy { Chef::Config[:zypper_check_gpg] }, default_description: "true"
|
data/lib/chef/version.rb
CHANGED
@@ -51,4 +51,32 @@ describe Chef::Mixin::Checksum do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe "checksum_match?" do
|
55
|
+
context "when checksum cases match" do
|
56
|
+
it "returns true" do
|
57
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", "u7ghbxikk3i9blsimmy2y2ionmxx")).to be true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when one checksum is uppercase and other is lowercase" do
|
62
|
+
it "returns true" do
|
63
|
+
expect(@checksum_user.checksum_match?("U7GHBXIKK3I9BLSIMMY2Y2IONMXX", "u7ghbxikk3i9blsimmy2y2ionmxx")).to be true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when checksums do not match" do
|
68
|
+
it "returns false" do
|
69
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", "09ee9c8cc70501763563bcf9c218")).to be false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "when checksum is nil" do
|
74
|
+
it "returns false" do
|
75
|
+
expect(@checksum_user.checksum_match?("u7ghbxikk3i9blsimmy2y2ionmxx", nil)).to be false
|
76
|
+
expect(@checksum_user.checksum_match?(nil, "09ee9c8cc70501763563bcf9c218")).to be false
|
77
|
+
expect(@checksum_user.checksum_match?(nil, nil)).to be false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
54
82
|
end
|
@@ -769,6 +769,42 @@ describe Chef::Provider::Cron do
|
|
769
769
|
end
|
770
770
|
end
|
771
771
|
|
772
|
+
context "when integers are provided to the resource to express time values" do
|
773
|
+
it "should not report any difference" do
|
774
|
+
@new_resource.minute(1)
|
775
|
+
@new_resource.hour(1)
|
776
|
+
@new_resource.day(1)
|
777
|
+
@new_resource.month(1)
|
778
|
+
@new_resource.weekday(1)
|
779
|
+
allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB)
|
780
|
+
# Chef Name: cronhole some stuff
|
781
|
+
1 1 1 1 1 /bin/true
|
782
|
+
|
783
|
+
CRONTAB
|
784
|
+
|
785
|
+
@provider.run_action(:create)
|
786
|
+
expect(@new_resource).not_to be_updated_by_last_action
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
context "when strings are provided to the resource to express time values" do
|
791
|
+
it "should not report any difference" do
|
792
|
+
@new_resource.minute("1")
|
793
|
+
@new_resource.hour("1")
|
794
|
+
@new_resource.day("1")
|
795
|
+
@new_resource.month("1")
|
796
|
+
@new_resource.weekday("1")
|
797
|
+
allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB)
|
798
|
+
# Chef Name: cronhole some stuff
|
799
|
+
1 1 1 1 1 /bin/true
|
800
|
+
|
801
|
+
CRONTAB
|
802
|
+
|
803
|
+
@provider.run_action(:create)
|
804
|
+
expect(@new_resource).not_to be_updated_by_last_action
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
772
808
|
context "when environment variable is used" do
|
773
809
|
before :each do
|
774
810
|
@provider.cron_exists = true
|
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: 18.0.
|
4
|
+
version: 18.0.185
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-15 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: 18.0.
|
19
|
+
version: 18.0.185
|
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: 18.0.
|
26
|
+
version: 18.0.185
|
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: 18.0.
|
33
|
+
version: 18.0.185
|
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: 18.0.
|
40
|
+
version: 18.0.185
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,9 +45,6 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.10'
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 3.2.28
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -55,9 +52,6 @@ dependencies:
|
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: '3.10'
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 3.2.28
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: train-winrm
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,7 +265,7 @@ dependencies:
|
|
271
265
|
version: 2.1.2
|
272
266
|
- - "<"
|
273
267
|
- !ruby/object:Gem::Version
|
274
|
-
version: '
|
268
|
+
version: '5.0'
|
275
269
|
type: :runtime
|
276
270
|
prerelease: false
|
277
271
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -281,7 +275,7 @@ dependencies:
|
|
281
275
|
version: 2.1.2
|
282
276
|
- - "<"
|
283
277
|
- !ruby/object:Gem::Version
|
284
|
-
version: '
|
278
|
+
version: '5.0'
|
285
279
|
- !ruby/object:Gem::Dependency
|
286
280
|
name: net-ftp
|
287
281
|
requirement: !ruby/object:Gem::Requirement
|