chef 18.5.0 → 18.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +11 -6
- data/chef-universal-mingw-ucrt.gemspec +1 -1
- data/chef.gemspec +19 -15
- data/lib/chef/application/client.rb +0 -12
- data/lib/chef/client.rb +1 -10
- data/lib/chef/compliance/default_attributes.rb +2 -2
- data/lib/chef/compliance/runner.rb +6 -11
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -3
- data/lib/chef/cookbook/synchronizer.rb +0 -5
- data/lib/chef/event_dispatch/dispatcher.rb +0 -1
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_access_control/unix.rb +9 -9
- data/lib/chef/file_content_management/deploy.rb +1 -4
- data/lib/chef/mixin/file_class.rb +1 -3
- data/lib/chef/mixin/get_source_from_package.rb +1 -1
- data/lib/chef/mixin/{homebrew_user.rb → homebrew.rb} +13 -16
- data/lib/chef/mixin/openssl_helper.rb +1 -12
- data/lib/chef/provider/cookbook_file.rb +1 -1
- data/lib/chef/provider/cron.rb +1 -1
- data/lib/chef/provider/directory.rb +15 -15
- data/lib/chef/provider/file.rb +29 -42
- data/lib/chef/provider/git.rb +8 -8
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/group/gpasswd.rb +2 -2
- data/lib/chef/provider/group/groupadd.rb +1 -1
- data/lib/chef/provider/group/groupmod.rb +2 -2
- data/lib/chef/provider/group/pw.rb +2 -2
- data/lib/chef/provider/group/solaris.rb +2 -2
- data/lib/chef/provider/group/usermod.rb +2 -2
- data/lib/chef/provider/group.rb +1 -1
- data/lib/chef/provider/http_request.rb +3 -2
- data/lib/chef/provider/ifconfig/aix.rb +1 -1
- data/lib/chef/provider/ifconfig/debian.rb +3 -3
- data/lib/chef/provider/ifconfig/redhat.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +1 -1
- data/lib/chef/provider/link.rb +10 -10
- data/lib/chef/provider/mount/aix.rb +4 -4
- data/lib/chef/provider/mount/linux.rb +4 -4
- data/lib/chef/provider/mount/mount.rb +11 -11
- data/lib/chef/provider/package/apt.rb +11 -2
- data/lib/chef/provider/package/bff.rb +3 -3
- data/lib/chef/provider/package/chocolatey.rb +2 -2
- data/lib/chef/provider/package/dnf/dnf_helper.py +7 -0
- data/lib/chef/provider/package/dpkg.rb +3 -3
- data/lib/chef/provider/package/freebsd/base.rb +1 -1
- data/lib/chef/provider/package/habitat.rb +3 -5
- data/lib/chef/provider/package/homebrew.rb +6 -9
- data/lib/chef/provider/package/ips.rb +2 -2
- data/lib/chef/provider/package/openbsd.rb +2 -3
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/paludis.rb +2 -2
- data/lib/chef/provider/package/portage.rb +1 -1
- data/lib/chef/provider/package/rpm.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +4 -0
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/package/snap.rb +2 -2
- data/lib/chef/provider/package/solaris.rb +4 -4
- data/lib/chef/provider/package/zypper.rb +4 -4
- data/lib/chef/provider/package.rb +1 -1
- data/lib/chef/provider/registry_key.rb +6 -0
- data/lib/chef/provider/remote_directory.rb +5 -5
- data/lib/chef/provider/remote_file/http.rb +3 -2
- data/lib/chef/provider/remote_file.rb +1 -1
- data/lib/chef/provider/route.rb +9 -9
- data/lib/chef/provider/service/aix.rb +1 -1
- data/lib/chef/provider/service/aixinit.rb +4 -4
- data/lib/chef/provider/service/arch.rb +6 -6
- data/lib/chef/provider/service/debian.rb +5 -5
- data/lib/chef/provider/service/freebsd.rb +7 -7
- data/lib/chef/provider/service/gentoo.rb +5 -5
- data/lib/chef/provider/service/init.rb +2 -2
- data/lib/chef/provider/service/insserv.rb +2 -2
- data/lib/chef/provider/service/invokercd.rb +1 -1
- data/lib/chef/provider/service/openbsd.rb +7 -7
- data/lib/chef/provider/service/redhat.rb +3 -3
- data/lib/chef/provider/service/solaris.rb +2 -2
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +2 -2
- data/lib/chef/provider/subversion.rb +8 -8
- data/lib/chef/provider/systemd_unit.rb +3 -3
- data/lib/chef/provider/template.rb +1 -1
- data/lib/chef/provider/user/aix.rb +3 -3
- data/lib/chef/provider/user/linux.rb +2 -7
- data/lib/chef/provider/user/pw.rb +3 -3
- data/lib/chef/provider/user/solaris.rb +7 -7
- data/lib/chef/provider/user/windows.rb +5 -0
- data/lib/chef/provider/user.rb +8 -7
- data/lib/chef/provider/yum_repository.rb +3 -1
- data/lib/chef/provider/zypper_repository.rb +1 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/resource/alternatives.rb +2 -2
- data/lib/chef/resource/apt_preference.rb +1 -1
- data/lib/chef/resource/apt_repository.rb +90 -15
- data/lib/chef/resource/apt_update.rb +3 -3
- data/lib/chef/resource/bff_package.rb +1 -1
- data/lib/chef/resource/chef_client_config.rb +3 -2
- data/lib/chef/resource/chef_sleep.rb +1 -1
- data/lib/chef/resource/cookbook_file.rb +1 -1
- data/lib/chef/resource/cron/cron.rb +1 -1
- data/lib/chef/resource/cron/cron_d.rb +1 -1
- data/lib/chef/resource/cron_access.rb +1 -1
- data/lib/chef/resource/directory.rb +1 -1
- data/lib/chef/resource/dpkg_package.rb +1 -1
- data/lib/chef/resource/file/verification/json.rb +1 -1
- data/lib/chef/resource/file/verification/systemd_unit.rb +1 -1
- data/lib/chef/resource/file/verification/yaml.rb +1 -1
- data/lib/chef/resource/file.rb +1 -1
- data/lib/chef/resource/freebsd_package.rb +2 -2
- data/lib/chef/resource/group.rb +1 -1
- data/lib/chef/resource/habitat/habitat_package.rb +1 -1
- data/lib/chef/resource/habitat/habitat_sup.rb +9 -9
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +2 -2
- data/lib/chef/resource/habitat_install.rb +3 -3
- data/lib/chef/resource/homebrew_cask.rb +19 -30
- data/lib/chef/resource/homebrew_tap.rb +32 -17
- data/lib/chef/resource/homebrew_update.rb +4 -4
- data/lib/chef/resource/hostname.rb +10 -11
- data/lib/chef/resource/http_request.rb +1 -1
- data/lib/chef/resource/ifconfig.rb +1 -1
- data/lib/chef/resource/inspec_input.rb +1 -3
- data/lib/chef/resource/inspec_waiver.rb +1 -1
- data/lib/chef/resource/inspec_waiver_file_entry.rb +1 -1
- data/lib/chef/resource/ips_package.rb +2 -2
- data/lib/chef/resource/kernel_module.rb +2 -2
- data/lib/chef/resource/link.rb +1 -1
- data/lib/chef/resource/locale.rb +2 -2
- data/lib/chef/resource/mount.rb +1 -1
- data/lib/chef/resource/notify_group.rb +1 -1
- data/lib/chef/resource/ohai.rb +1 -1
- data/lib/chef/resource/ohai_hint.rb +1 -1
- data/lib/chef/resource/openbsd_package.rb +2 -2
- data/lib/chef/resource/package.rb +1 -1
- data/lib/chef/resource/pacman_package.rb +1 -1
- data/lib/chef/resource/paludis_package.rb +1 -1
- data/lib/chef/resource/portage_package.rb +1 -1
- data/lib/chef/resource/reboot.rb +1 -1
- data/lib/chef/resource/registry_key.rb +18 -0
- data/lib/chef/resource/remote_directory.rb +1 -1
- data/lib/chef/resource/remote_file.rb +1 -1
- data/lib/chef/resource/rhsm_errata.rb +1 -1
- data/lib/chef/resource/rhsm_errata_level.rb +1 -1
- data/lib/chef/resource/rhsm_register.rb +1 -1
- data/lib/chef/resource/rhsm_repo.rb +4 -3
- data/lib/chef/resource/rhsm_subscription.rb +9 -8
- data/lib/chef/resource/route.rb +1 -1
- data/lib/chef/resource/rpm_package.rb +1 -1
- data/lib/chef/resource/scm/git.rb +1 -1
- data/lib/chef/resource/scm/subversion.rb +1 -1
- data/lib/chef/resource/selinux/common_helpers.rb +1 -1
- data/lib/chef/resource/selinux_boolean.rb +1 -1
- data/lib/chef/resource/selinux_fcontext.rb +3 -3
- data/lib/chef/resource/selinux_install.rb +1 -1
- data/lib/chef/resource/selinux_login.rb +1 -1
- data/lib/chef/resource/selinux_module.rb +5 -5
- data/lib/chef/resource/selinux_permissive.rb +2 -2
- data/lib/chef/resource/selinux_port.rb +2 -2
- data/lib/chef/resource/selinux_state.rb +2 -2
- data/lib/chef/resource/selinux_user.rb +1 -1
- data/lib/chef/resource/smartos_package.rb +2 -2
- data/lib/chef/resource/snap_package.rb +1 -1
- data/lib/chef/resource/solaris_package.rb +1 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sudo.rb +5 -5
- data/lib/chef/resource/support/client.erb +3 -2
- data/lib/chef/resource/swap_file.rb +6 -6
- data/lib/chef/resource/sysctl.rb +5 -5
- data/lib/chef/resource/systemd_unit.rb +1 -1
- data/lib/chef/resource/template.rb +1 -1
- data/lib/chef/resource/timezone.rb +5 -5
- data/lib/chef/resource/user/aix_user.rb +2 -2
- data/lib/chef/resource/user/linux_user.rb +2 -2
- data/lib/chef/resource/user/pw_user.rb +2 -2
- data/lib/chef/resource/user/solaris_user.rb +2 -2
- data/lib/chef/resource/user_ulimit.rb +1 -1
- data/lib/chef/resource/yum_repository.rb +1 -1
- data/lib/chef/resource/zypper_package.rb +2 -2
- data/lib/chef/resource/zypper_repository.rb +2 -2
- data/lib/chef/resource.rb +1 -0
- data/lib/chef/resource_inspector.rb +25 -7
- data/lib/chef/resource_reporter.rb +1 -0
- data/lib/chef/run_lock.rb +0 -3
- data/lib/chef/scan_access_control.rb +6 -6
- data/lib/chef/util/backup.rb +1 -1
- data/lib/chef/util/diff.rb +1 -14
- data/lib/chef/util/file_edit.rb +4 -4
- data/lib/chef/util/powershell/ps_credential.rb +10 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/registry.rb +5 -1
- data/lib/chef/win32/security.rb +9 -0
- data/lib/chef.rb +0 -2
- data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +6 -6
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/registry_spec.rb +276 -609
- data/spec/integration/client/open_ssl_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/chef_helpers.rb +2 -2
- data/spec/support/platform_helpers.rb +8 -0
- data/spec/support/shared/functional/file_resource.rb +3 -3
- data/spec/tiny_server.rb +5 -2
- data/spec/unit/mixin/homebrew_spec.rb +118 -0
- data/spec/unit/provider/apt_repository_spec.rb +14 -9
- data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
- data/spec/unit/provider/package/homebrew_spec.rb +4 -1
- data/spec/unit/provider/registry_key_spec.rb +18 -17
- data/spec/unit/provider/route_spec.rb +4 -6
- data/spec/unit/provider/user/windows_spec.rb +1 -0
- data/spec/unit/resource/rhsm_repo_spec.rb +0 -1
- data/spec/unit/resource/rhsm_subscription_spec.rb +0 -2
- data/spec/unit/resource_inspector_spec.rb +36 -0
- data/spec/unit/util/powershell/ps_credential_spec.rb +6 -0
- metadata +36 -44
- data/lib/chef/file_content_management/deploy/target_io.rb +0 -29
- data/lib/chef/provider/.gitkeep +0 -0
- data/lib/chef/provider/package/snap_tm.rb +0 -79
- data/lib/chef/resource/.gitkeep +0 -0
- data/lib/chef/target_io/dir.rb +0 -12
- data/lib/chef/target_io/etc.rb +0 -16
- data/lib/chef/target_io/file.rb +0 -12
- data/lib/chef/target_io/fileutils.rb +0 -12
- data/lib/chef/target_io/http.rb +0 -22
- data/lib/chef/target_io/io.rb +0 -12
- data/lib/chef/target_io/shadow.rb +0 -44
- data/lib/chef/target_io/train/dir.rb +0 -69
- data/lib/chef/target_io/train/etc.rb +0 -112
- data/lib/chef/target_io/train/file.rb +0 -219
- data/lib/chef/target_io/train/fileutils.rb +0 -220
- data/lib/chef/target_io/train/http.rb +0 -117
- data/lib/chef/target_io/train/io.rb +0 -13
- data/lib/chef/target_io/train/shadow.rb +0 -52
- data/lib/chef/target_io/train_compat.rb +0 -7
- data/lib/chef/target_io.rb +0 -9
- data/spec/unit/mixin/homebrew_user_spec.rb +0 -119
- /data/spec/functional/assets/yumrepo-empty/repodata/{01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2 → 01a3b-filelists.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo-empty/repodata/{401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz → 401dc-filelists.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo-empty/repodata/{5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2 → 5dc1e-primary.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo-empty/repodata/{6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz → 6bf96-other.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo-empty/repodata/{7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2 → 7c365-other.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo-empty/repodata/{dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz → dabe2-primary.xml.gz} +0 -0
@@ -1,119 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Joshua Timberman (<joshua@chef.io>)
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (c) Chef Software Inc.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
|
18
|
-
require "spec_helper"
|
19
|
-
require "chef/mixin/homebrew_user"
|
20
|
-
|
21
|
-
class ExampleHomebrewUser
|
22
|
-
include Chef::Mixin::HomebrewUser
|
23
|
-
end
|
24
|
-
|
25
|
-
describe Chef::Mixin::HomebrewUser do
|
26
|
-
let(:homebrew_user) { ExampleHomebrewUser.new }
|
27
|
-
let(:node) { Chef::Node.new }
|
28
|
-
|
29
|
-
describe "when the homebrew user is provided" do
|
30
|
-
let(:uid) { 1001 }
|
31
|
-
let(:user) { "foo" }
|
32
|
-
|
33
|
-
it "returns the homebrew user without looking at the file when uid is provided" do
|
34
|
-
expect(File).to receive(:exist?).exactly(0).times
|
35
|
-
expect(homebrew_user.find_homebrew_uid(uid)).to eq(uid)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns the homebrew user without looking at the file when name is provided" do
|
39
|
-
expect(File).to receive(:exist?).exactly(0).times
|
40
|
-
allow(Etc).to receive_message_chain(:getpwnam, :uid).and_return(uid)
|
41
|
-
expect(homebrew_user.find_homebrew_uid(user)).to eq(uid)
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
shared_examples "successfully find executable" do
|
47
|
-
let(:user) { nil }
|
48
|
-
let(:brew_owner) { 2001 }
|
49
|
-
let(:default_brew_path) { "/usr/local/bin/brew" }
|
50
|
-
let(:default_brew_path_arm) { "/opt/homebrew/bin/brew" }
|
51
|
-
let(:default_brew_path_linux) { "/home/linuxbrew/.linuxbrew/bin/brew" }
|
52
|
-
let(:stat_double) do
|
53
|
-
d = double
|
54
|
-
expect(d).to receive(:uid).and_return(brew_owner)
|
55
|
-
d
|
56
|
-
end
|
57
|
-
|
58
|
-
context "debug statement prints owner name" do
|
59
|
-
|
60
|
-
before do
|
61
|
-
expect(Etc).to receive(:getpwuid).with(brew_owner).and_return(OpenStruct.new(name: "name"))
|
62
|
-
end
|
63
|
-
|
64
|
-
def false_unless_specific_value(object, method, value)
|
65
|
-
allow(object).to receive(method).and_return(false)
|
66
|
-
allow(object).to receive(method).with(value).and_return(true)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "returns the owner of the brew executable when it is at a default location for x86_64 machines" do
|
70
|
-
false_unless_specific_value(File, :exist?, default_brew_path)
|
71
|
-
false_unless_specific_value(File, :executable?, default_brew_path)
|
72
|
-
allow(File).to receive(:stat).with(default_brew_path).and_return(stat_double)
|
73
|
-
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "returns the owner of the brew executable when it is at a default location for arm machines" do
|
77
|
-
false_unless_specific_value(File, :exist?, default_brew_path_arm)
|
78
|
-
false_unless_specific_value(File, :executable?, default_brew_path_arm)
|
79
|
-
allow(File).to receive(:stat).with(default_brew_path_arm).and_return(stat_double)
|
80
|
-
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "returns the owner of the brew executable when it is at a default location for linux machines" do
|
84
|
-
false_unless_specific_value(File, :exist?, default_brew_path_linux)
|
85
|
-
false_unless_specific_value(File, :executable?, default_brew_path_linux)
|
86
|
-
allow(File).to receive(:stat).with(default_brew_path_linux).and_return(stat_double)
|
87
|
-
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns the owner of the brew executable when it is not at a default location" do
|
91
|
-
allow_any_instance_of(ExampleHomebrewUser).to receive(:which).and_return("/foo")
|
92
|
-
false_unless_specific_value(File, :exist?, "/foo")
|
93
|
-
false_unless_specific_value(File, :executable?, "/foo")
|
94
|
-
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("/foo")
|
95
|
-
allow(File).to receive(:stat).with("/foo").and_return(stat_double)
|
96
|
-
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "when the homebrew user is not provided" do
|
103
|
-
|
104
|
-
it "raises an error if no executable is found" do
|
105
|
-
expect(File).to receive(:exist?).and_return(nil).at_least(:once)
|
106
|
-
expect { homebrew_user.find_homebrew_uid(user) }.to raise_error(Chef::Exceptions::CannotDetermineHomebrewOwner)
|
107
|
-
end
|
108
|
-
|
109
|
-
include_examples "successfully find executable"
|
110
|
-
|
111
|
-
context "the executable is owned by root" do
|
112
|
-
include_examples "successfully find executable" do
|
113
|
-
let(:brew_owner) { 0 }
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|