chef 18.3.0-x64-mingw-ucrt → 18.4.12-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/chef.gemspec +2 -2
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +7 -9
- data/lib/chef/cookbook/synchronizer.rb +2 -3
- data/lib/chef/delayed_evaluator.rb +4 -0
- data/lib/chef/file_access_control/windows.rb +4 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +2 -0
- data/lib/chef/mixin/homebrew_user.rb +6 -3
- data/lib/chef/monkey_patches/net-http.rb +5 -5
- data/lib/chef/node/attribute_collections.rb +2 -1
- data/lib/chef/node/immutable_collections.rb +2 -1
- data/lib/chef/node/mixin/state_tracking_array.rb +41 -0
- data/lib/chef/node.rb +23 -1
- data/lib/chef/provider/package/apt.rb +11 -2
- data/lib/chef/provider/package/chocolatey.rb +228 -24
- data/lib/chef/provider/package/zypper.rb +5 -0
- data/lib/chef/provider/powershell_script.rb +96 -6
- data/lib/chef/provider/service/systemd.rb +23 -8
- data/lib/chef/provider/service/windows.rb +1 -0
- data/lib/chef/provider/service.rb +14 -0
- data/lib/chef/provider/user.rb +5 -1
- data/lib/chef/recipe.rb +3 -11
- data/lib/chef/resource/_rest_resource.rb +1 -1
- data/lib/chef/resource/apt_package.rb +19 -0
- data/lib/chef/resource/apt_repository.rb +2 -1
- data/lib/chef/resource/chef_client_systemd_timer.rb +1 -1
- data/lib/chef/resource/chocolatey_installer.rb +207 -0
- data/lib/chef/resource/chocolatey_package.rb +8 -0
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/locale.rb +5 -2
- data/lib/chef/resource/macos_pkg.rb +111 -0
- data/lib/chef/resource/powershell_script.rb +5 -1
- data/lib/chef/resource/service.rb +3 -0
- data/lib/chef/resource/sudo.rb +37 -2
- data/lib/chef/resource/support/ulimit.erb +40 -0
- data/lib/chef/resource/user_ulimit.rb +38 -0
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/data/trusted_certs/example.crt +29 -20
- data/spec/data/trusted_certs/example_no_cn.crt +30 -34
- data/spec/functional/resource/chocolatey_package_spec.rb +2 -2
- data/spec/functional/resource/zypper_package_spec.rb +10 -0
- data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +1 -1
- data/spec/unit/delayed_evaluator_spec.rb +35 -0
- data/spec/unit/node_spec.rb +6 -0
- data/spec/unit/provider/package/apt_spec.rb +18 -13
- data/spec/unit/provider/package/chocolatey_spec.rb +40 -12
- data/spec/unit/provider/powershell_script_spec.rb +100 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +1 -0
- data/spec/unit/provider/user/linux_spec.rb +10 -0
- data/spec/unit/resource/chef_client_systemd_timer_spec.rb +1 -1
- data/spec/unit/resource/chocolatey_installer_spec.rb +151 -0
- data/spec/unit/resource/macos_pkg_spec.rb +38 -0
- data/spec/unit/resource/powershell_script_spec.rb +2 -2
- metadata +20 -8
@@ -102,7 +102,7 @@ describe Chef::Resource::ChefClientSystemdTimer do
|
|
102
102
|
|
103
103
|
it "sets CPUQuota if cpu_quota property is set" do
|
104
104
|
resource.cpu_quota 50
|
105
|
-
expect(provider.service_content["Service"]["CPUQuota"]).to eq(50)
|
105
|
+
expect(provider.service_content["Service"]["CPUQuota"]).to eq("50%")
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::ChocolateyInstaller do
|
21
|
+
include RecipeDSLHelper
|
22
|
+
|
23
|
+
let(:resource) { Chef::Resource::ChocolateyInstaller.new("fakey_fakerton") }
|
24
|
+
let(:config) do
|
25
|
+
<<-CONFIG
|
26
|
+
<?xml version="1.0" encoding="utf-8"?>
|
27
|
+
<chocolatey xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
28
|
+
<config>
|
29
|
+
<add key="containsLegacyPackageInstalls" value="true" description="Install has packages installed prior to 0.9.9 series." />
|
30
|
+
</config>
|
31
|
+
<sources>
|
32
|
+
<source id="chocolatey" value="https://chocolatey.org/api/v2/" disabled="false" bypassProxy="false" selfService="false" adminOnly="false" priority="0" />
|
33
|
+
</sources>
|
34
|
+
<features>
|
35
|
+
<feature name="checksumFiles" enabled="true" setExplicitly="false" description="Checksum files when pulled in from internet (based on package)." />
|
36
|
+
</features>
|
37
|
+
<apiKeys />
|
38
|
+
</chocolatey>
|
39
|
+
CONFIG
|
40
|
+
end
|
41
|
+
|
42
|
+
# we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs
|
43
|
+
before(:each) do
|
44
|
+
@original_env = ENV.to_hash
|
45
|
+
ENV["ALLUSERSPROFILE"] = "C:\\ProgramData"
|
46
|
+
end
|
47
|
+
|
48
|
+
after(:each) do
|
49
|
+
ENV.clear
|
50
|
+
ENV.update(@original_env)
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "Basic Resource Settings" do
|
54
|
+
context "on windows", :windows_only do
|
55
|
+
it "supports :install, :uninstall, :upgrade actions" do
|
56
|
+
expect { resource.action :install }.not_to raise_error
|
57
|
+
expect { resource.action :uninstall }.not_to raise_error
|
58
|
+
expect { resource.action :upgrade }.not_to raise_error
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "Basic chocolatey settings" do
|
64
|
+
context "on windows", :windows_only do
|
65
|
+
it "has a resource name of :chocolatey_installer" do
|
66
|
+
expect(resource.resource_name).to eql(:chocolatey_installer)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "sets the default action as :install" do
|
70
|
+
expect(resource.action).to eql([:install])
|
71
|
+
end
|
72
|
+
|
73
|
+
it "supports :install and :uninstall actions" do
|
74
|
+
expect { resource.action :install }.not_to raise_error
|
75
|
+
expect { resource.action :uninstall }.not_to raise_error
|
76
|
+
end
|
77
|
+
|
78
|
+
it "does not support bologna install options" do
|
79
|
+
expect { resource.action :foo }.to raise_error(Chef::Exceptions::ValidationFailed)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "Installing chocolatey" do
|
85
|
+
context "on windows", :windows_only do
|
86
|
+
it "can install Chocolatey with parameters" do
|
87
|
+
resource.chocolatey_version = "1.4.0"
|
88
|
+
expect { resource.action :install }.not_to raise_error
|
89
|
+
end
|
90
|
+
|
91
|
+
it "logs a warning if a chocolatey install cannot be found" do
|
92
|
+
allow(::File).to receive(:exist?).with('C:\ProgramData\chocolatey\bin\choco.exe').and_return(false)
|
93
|
+
expect { Chef::Log.warn("Chocolatey is already uninstalled.") }.not_to output.to_stderr
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "Chocolatey is idempotent because" do
|
99
|
+
context "on windows", :windows_only do
|
100
|
+
it "it does not install choco again if it is already installed" do
|
101
|
+
install_choco
|
102
|
+
chocolatey_installer "install" do
|
103
|
+
action :install
|
104
|
+
end.should_not_be_updated
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "upgrading choco versions" do
|
110
|
+
|
111
|
+
context "on windows", :windows_only do
|
112
|
+
describe "when the versions do not match" do
|
113
|
+
it "upgrades if the proposed version is newer" do
|
114
|
+
allow(resource).to receive(:get_choco_version).and_return(Gem::Version.new("1.2.2"))
|
115
|
+
allow(resource).to receive(:chocolatey_version).and_return(Gem::Version.new("4.2.2"))
|
116
|
+
expect { resource.action :upgrade }.not_to raise_error
|
117
|
+
allow(resource).to receive(:get_choco_version).and_return(Gem::Version.new("4.2.2"))
|
118
|
+
expect(resource.get_choco_version).to eql(Gem::Version.new("4.2.2"))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
describe "when the versions match" do
|
122
|
+
it "does not upgrade if the old version is identical" do
|
123
|
+
allow(resource).to receive(:get_choco_version).and_return(Gem::Version.new("2.2.2"))
|
124
|
+
allow(resource).to receive(:chocolatey_version).and_return(Gem::Version.new("2.2.2"))
|
125
|
+
expect { resource.action :upgrade }.not_to raise_error
|
126
|
+
expect(resource).not_to be_updated
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "Uninstalling chocolatey" do
|
133
|
+
context "on windows", :windows_only do
|
134
|
+
it "doesn't error out uninstalling chocolatey if chocolatey is not installed" do
|
135
|
+
allow(::File).to receive(:exist?).with('C:\ProgramData\chocolatey\bin\choco.exe').and_return(false)
|
136
|
+
expect { resource.action :uninstall }.not_to raise_error
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def install_choco
|
142
|
+
require "chef-powershell"
|
143
|
+
include ChefPowerShell::ChefPowerShellModule::PowerShellExec
|
144
|
+
powershell_code = <<-CODE
|
145
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
146
|
+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
147
|
+
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
148
|
+
CODE
|
149
|
+
powershell_exec(powershell_code)
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::MacosPkg do
|
21
|
+
let(:resource) { Chef::Resource::MacosPkg.new("fakey_fakerton") }
|
22
|
+
|
23
|
+
it "has a resource name of :macos_pkg" do
|
24
|
+
expect(resource.resource_name).to eql(:macos_pkg)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "sets the default action as :install" do
|
28
|
+
expect(resource.action).to eql([:install])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "supports :install action" do
|
32
|
+
expect { resource.action :install }.not_to raise_error
|
33
|
+
end
|
34
|
+
|
35
|
+
it "target property defaults to /" do
|
36
|
+
expect(resource.target).to eql("/")
|
37
|
+
end
|
38
|
+
end
|
@@ -47,9 +47,9 @@ describe Chef::Resource::PowershellScript do
|
|
47
47
|
expect(resource.convert_boolean_return).to eq(false)
|
48
48
|
end
|
49
49
|
|
50
|
-
it "inherits exactly the :cwd, :domain, :environment, :group, :password, :path, :user, :umask, :architecture, :elevated, :interpreter, :login properties from a parent resource class" do
|
50
|
+
it "inherits exactly the :cwd, :domain, :environment, :group, :password, :path, :user, :umask, :architecture, :elevated, :interpreter, :login, :use_inline_powershell properties from a parent resource class" do
|
51
51
|
inherited_difference = Chef::Resource::PowershellScript.guard_inherited_attributes -
|
52
|
-
%i{cwd domain environment group password path user umask architecture elevated interpreter login}
|
52
|
+
%i{cwd domain environment group password path user umask architecture elevated interpreter login use_inline_powershell}
|
53
53
|
|
54
54
|
expect(inherited_difference).to eq([])
|
55
55
|
end
|
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.
|
4
|
+
version: 18.4.12
|
5
5
|
platform: x64-mingw-ucrt
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-17 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.
|
19
|
+
version: 18.4.12
|
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.
|
26
|
+
version: 18.4.12
|
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.
|
33
|
+
version: 18.4.12
|
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.
|
40
|
+
version: 18.4.12
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,6 +221,9 @@ dependencies:
|
|
221
221
|
- - ">="
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '5'
|
224
|
+
- - "<"
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '6'
|
224
227
|
type: :runtime
|
225
228
|
prerelease: false
|
226
229
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -228,6 +231,9 @@ dependencies:
|
|
228
231
|
- - ">="
|
229
232
|
- !ruby/object:Gem::Version
|
230
233
|
version: '5'
|
234
|
+
- - "<"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '6'
|
231
237
|
- !ruby/object:Gem::Dependency
|
232
238
|
name: ffi
|
233
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -458,14 +464,14 @@ dependencies:
|
|
458
464
|
name: unf_ext
|
459
465
|
requirement: !ruby/object:Gem::Requirement
|
460
466
|
requirements:
|
461
|
-
- - "
|
467
|
+
- - "~>"
|
462
468
|
- !ruby/object:Gem::Version
|
463
469
|
version: 0.0.8.2
|
464
470
|
type: :runtime
|
465
471
|
prerelease: false
|
466
472
|
version_requirements: !ruby/object:Gem::Requirement
|
467
473
|
requirements:
|
468
|
-
- - "
|
474
|
+
- - "~>"
|
469
475
|
- !ruby/object:Gem::Version
|
470
476
|
version: 0.0.8.2
|
471
477
|
- !ruby/object:Gem::Dependency
|
@@ -1664,6 +1670,7 @@ files:
|
|
1664
1670
|
- lib/chef/node/mixin/immutablize_hash.rb
|
1665
1671
|
- lib/chef/node/mixin/mashy_array.rb
|
1666
1672
|
- lib/chef/node/mixin/state_tracking.rb
|
1673
|
+
- lib/chef/node/mixin/state_tracking_array.rb
|
1667
1674
|
- lib/chef/node_map.rb
|
1668
1675
|
- lib/chef/null_logger.rb
|
1669
1676
|
- lib/chef/org.rb
|
@@ -1849,6 +1856,7 @@ files:
|
|
1849
1856
|
- lib/chef/resource/chef_vault_secret.rb
|
1850
1857
|
- lib/chef/resource/chocolatey_config.rb
|
1851
1858
|
- lib/chef/resource/chocolatey_feature.rb
|
1859
|
+
- lib/chef/resource/chocolatey_installer.rb
|
1852
1860
|
- lib/chef/resource/chocolatey_package.rb
|
1853
1861
|
- lib/chef/resource/chocolatey_source.rb
|
1854
1862
|
- lib/chef/resource/conditional.rb
|
@@ -1902,6 +1910,7 @@ files:
|
|
1902
1910
|
- lib/chef/resource/locale.rb
|
1903
1911
|
- lib/chef/resource/log.rb
|
1904
1912
|
- lib/chef/resource/lwrp_base.rb
|
1913
|
+
- lib/chef/resource/macos_pkg.rb
|
1905
1914
|
- lib/chef/resource/macos_userdefaults.rb
|
1906
1915
|
- lib/chef/resource/macosx_service.rb
|
1907
1916
|
- lib/chef/resource/macports_package.rb
|
@@ -2781,6 +2790,7 @@ files:
|
|
2781
2790
|
- spec/unit/decorator/lazy_array_spec.rb
|
2782
2791
|
- spec/unit/decorator/lazy_spec.rb
|
2783
2792
|
- spec/unit/decorator_spec.rb
|
2793
|
+
- spec/unit/delayed_evaluator_spec.rb
|
2784
2794
|
- spec/unit/deprecated_spec.rb
|
2785
2795
|
- spec/unit/deprecation_spec.rb
|
2786
2796
|
- spec/unit/digester_spec.rb
|
@@ -3026,6 +3036,7 @@ files:
|
|
3026
3036
|
- spec/unit/resource/chef_vault_secret_spec.rb
|
3027
3037
|
- spec/unit/resource/chocolatey_config_spec.rb
|
3028
3038
|
- spec/unit/resource/chocolatey_feature_spec.rb
|
3039
|
+
- spec/unit/resource/chocolatey_installer_spec.rb
|
3029
3040
|
- spec/unit/resource/chocolatey_package_spec.rb
|
3030
3041
|
- spec/unit/resource/chocolatey_source_spec.rb
|
3031
3042
|
- spec/unit/resource/conditional_action_not_nothing_spec.rb
|
@@ -3068,6 +3079,7 @@ files:
|
|
3068
3079
|
- spec/unit/resource/link_spec.rb
|
3069
3080
|
- spec/unit/resource/locale_spec.rb
|
3070
3081
|
- spec/unit/resource/log_spec.rb
|
3082
|
+
- spec/unit/resource/macos_pkg_spec.rb
|
3071
3083
|
- spec/unit/resource/macos_user_defaults_spec.rb
|
3072
3084
|
- spec/unit/resource/macosx_service.rb
|
3073
3085
|
- spec/unit/resource/macports_package_spec.rb
|