chef 18.5.0 → 18.6.2
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 +8 -3
- data/chef-universal-mingw-ucrt.gemspec +1 -1
- data/chef.gemspec +2 -2
- data/lib/chef/application/client.rb +0 -12
- data/lib/chef/client.rb +1 -10
- data/lib/chef/compliance/runner.rb +0 -10
- data/lib/chef/cookbook/remote_file_vendor.rb +3 -2
- data/lib/chef/cookbook/synchronizer.rb +0 -5
- 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/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 +1 -1
- 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/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 +9 -7
- 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/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_inspector.rb +25 -7
- 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/version.rb +1 -1
- data/lib/chef/win32/registry.rb +5 -0
- data/lib/chef/win32/security.rb +9 -0
- data/lib/chef.rb +0 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- 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/unit/mixin/homebrew_spec.rb +118 -0
- data/spec/unit/provider/apt_repository_spec.rb +1 -1
- data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
- data/spec/unit/provider/package/homebrew_spec.rb +4 -1
- 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
- metadata +20 -28
- 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/lib/chef/providers.rb
CHANGED
|
@@ -74,7 +74,6 @@ require_relative "provider/package/cab"
|
|
|
74
74
|
require_relative "provider/package/powershell"
|
|
75
75
|
require_relative "provider/package/msu"
|
|
76
76
|
require_relative "provider/package/snap"
|
|
77
|
-
require_relative "provider/package/snap_tm"
|
|
78
77
|
require_relative "provider/package/habitat"
|
|
79
78
|
|
|
80
79
|
require_relative "provider/service/arch"
|
|
@@ -23,7 +23,7 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class Alternatives < Chef::Resource
|
|
25
25
|
|
|
26
|
-
provides(:alternatives
|
|
26
|
+
provides(:alternatives) { true }
|
|
27
27
|
|
|
28
28
|
description "Use the **alternatives** resource to configure command alternatives in Linux using the alternatives or update-alternatives packages."
|
|
29
29
|
introduced "16.0"
|
|
@@ -113,7 +113,7 @@ class Chef
|
|
|
113
113
|
|
|
114
114
|
requirements.assert(:install, :set, :remove) do |a|
|
|
115
115
|
a.assertion do
|
|
116
|
-
::
|
|
116
|
+
::File.exist?(new_resource.path)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
a.whyrun("Assuming file #{new_resource.path} already exists or was created already")
|
|
@@ -22,7 +22,7 @@ class Chef
|
|
|
22
22
|
class Resource
|
|
23
23
|
class AptPreference < Chef::Resource
|
|
24
24
|
|
|
25
|
-
provides(:apt_preference
|
|
25
|
+
provides(:apt_preference) { true }
|
|
26
26
|
|
|
27
27
|
description "Use the **apt_preference** resource to create APT [preference files](https://wiki.debian.org/AptPreferences). Preference files are used to control which package versions and sources are prioritized during installation."
|
|
28
28
|
introduced "13.3"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
#
|
|
18
18
|
|
|
19
19
|
require_relative "../resource"
|
|
20
|
+
require_relative "../http/simple"
|
|
20
21
|
require "tmpdir" unless defined?(Dir.mktmpdir)
|
|
21
22
|
module Addressable
|
|
22
23
|
autoload :URI, "addressable/uri"
|
|
@@ -26,7 +27,7 @@ class Chef
|
|
|
26
27
|
class Resource
|
|
27
28
|
class AptRepository < Chef::Resource
|
|
28
29
|
|
|
29
|
-
provides(:apt_repository
|
|
30
|
+
provides(:apt_repository) { true }
|
|
30
31
|
|
|
31
32
|
description "Use the **apt_repository** resource to specify additional APT repositories. Adding a new repository will update the APT package cache immediately."
|
|
32
33
|
introduced "12.9"
|
|
@@ -98,6 +99,7 @@ class Chef
|
|
|
98
99
|
```
|
|
99
100
|
|
|
100
101
|
**Add repository that needs custom options**:
|
|
102
|
+
|
|
101
103
|
```ruby
|
|
102
104
|
apt_repository 'corretto' do
|
|
103
105
|
uri 'https://apt.corretto.aws'
|
|
@@ -171,7 +173,7 @@ class Chef
|
|
|
171
173
|
default: true, desired_state: false
|
|
172
174
|
|
|
173
175
|
property :options, [String, Array],
|
|
174
|
-
description: "Additional options to set for the repository",
|
|
176
|
+
description: "Additional options to set for the repository.",
|
|
175
177
|
default: [], coerce: proc { |x| Array(x) }
|
|
176
178
|
|
|
177
179
|
default_action :add
|
|
@@ -287,8 +289,8 @@ class Chef
|
|
|
287
289
|
def install_key_from_uri(key)
|
|
288
290
|
key_name = key.gsub(/[^0-9A-Za-z\-]/, "_")
|
|
289
291
|
cached_keyfile = ::File.join(Chef::Config[:file_cache_path], key_name)
|
|
290
|
-
tmp_dir =
|
|
291
|
-
at_exit {
|
|
292
|
+
tmp_dir = Dir.mktmpdir(".gpg")
|
|
293
|
+
at_exit { FileUtils.remove_entry(tmp_dir) }
|
|
292
294
|
|
|
293
295
|
declare_resource(key_type(key), cached_keyfile) do
|
|
294
296
|
source key
|
|
@@ -358,7 +360,7 @@ class Chef
|
|
|
358
360
|
# @return [void]
|
|
359
361
|
def install_ppa_key(owner, repo)
|
|
360
362
|
url = "https://launchpad.net/api/1.0/~#{owner}/+archive/#{repo}"
|
|
361
|
-
key_id =
|
|
363
|
+
key_id = Chef::HTTP::Simple.new(url).get("signing_key_fingerprint").delete('"')
|
|
362
364
|
install_key_from_keyserver(key_id, "keyserver.ubuntu.com")
|
|
363
365
|
rescue Net::HTTPClientException => e
|
|
364
366
|
raise "Could not access Launchpad ppa API: #{e.message}"
|
|
@@ -432,7 +434,7 @@ class Chef
|
|
|
432
434
|
# @return [void]
|
|
433
435
|
def cleanup_legacy_file!
|
|
434
436
|
legacy_path = "/etc/apt/sources.list.d/#{new_resource.name}.list"
|
|
435
|
-
if new_resource.name != new_resource.repo_name && ::
|
|
437
|
+
if new_resource.name != new_resource.repo_name && ::File.exist?(legacy_path)
|
|
436
438
|
converge_by "Cleaning up legacy #{legacy_path} repo file" do
|
|
437
439
|
file legacy_path do
|
|
438
440
|
action :delete
|
|
@@ -498,7 +500,7 @@ class Chef
|
|
|
498
500
|
return unless debian?
|
|
499
501
|
|
|
500
502
|
cleanup_legacy_file!
|
|
501
|
-
if ::
|
|
503
|
+
if ::File.exist?("/etc/apt/sources.list.d/#{new_resource.repo_name}.list")
|
|
502
504
|
converge_by "Removing #{new_resource.repo_name} repository from /etc/apt/sources.list.d/" do
|
|
503
505
|
apt_update new_resource.name do
|
|
504
506
|
ignore_failure true
|
|
@@ -23,7 +23,7 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class AptUpdate < Chef::Resource
|
|
25
25
|
|
|
26
|
-
provides(:apt_update
|
|
26
|
+
provides(:apt_update) { true }
|
|
27
27
|
|
|
28
28
|
description "Use the **apt_update** resource to manage APT repository updates on Debian and Ubuntu platforms."
|
|
29
29
|
introduced "12.7"
|
|
@@ -62,8 +62,8 @@ class Chef
|
|
|
62
62
|
#
|
|
63
63
|
# @return [Boolean]
|
|
64
64
|
def apt_up_to_date?
|
|
65
|
-
::
|
|
66
|
-
::
|
|
65
|
+
::File.exist?("#{STAMP_DIR}/update-success-stamp") &&
|
|
66
|
+
::File.mtime("#{STAMP_DIR}/update-success-stamp") > Time.now - new_resource.frequency
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def do_update
|
|
@@ -23,7 +23,7 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class BffPackage < Chef::Resource::Package
|
|
25
25
|
|
|
26
|
-
provides :bff_package
|
|
26
|
+
provides :bff_package
|
|
27
27
|
|
|
28
28
|
description "Use the **bff_package** resource to manage packages for the AIX platform using the installp utility. When a package is installed from a local file, it must be added to the node using the **remote_file** or **cookbook_file** resources."
|
|
29
29
|
introduced "12.0"
|
|
@@ -21,7 +21,7 @@ class Chef
|
|
|
21
21
|
class Resource
|
|
22
22
|
class ChefClientConfig < Chef::Resource
|
|
23
23
|
|
|
24
|
-
provides :chef_client_config
|
|
24
|
+
provides :chef_client_config
|
|
25
25
|
|
|
26
26
|
description "Use the **chef_client_config** resource to create a client.rb file in the #{ChefUtils::Dist::Infra::PRODUCT} configuration directory. See the [client.rb docs](https://docs.chef.io/config_rb_client/) for more details on options available in the client.rb configuration file."
|
|
27
27
|
introduced "16.6"
|
|
@@ -195,7 +195,8 @@ class Chef
|
|
|
195
195
|
|
|
196
196
|
property :policy_persist_run_list, [true, false],
|
|
197
197
|
description: "Override run lists defined in a Policyfile with the `run_list` defined on the #{ChefUtils::Dist::Server::PRODUCT}.",
|
|
198
|
-
introduced: "17.3"
|
|
198
|
+
introduced: "17.3",
|
|
199
|
+
default: false
|
|
199
200
|
|
|
200
201
|
property :minimal_ohai, [true, false],
|
|
201
202
|
description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this to true may break cookbooks that assume all Ohai data will be present.",
|
|
@@ -20,7 +20,7 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class ChefSleep < Chef::Resource
|
|
23
|
-
provides :chef_sleep
|
|
23
|
+
provides :chef_sleep
|
|
24
24
|
|
|
25
25
|
description "Use the **chef_sleep** resource to pause (sleep) for a number of seconds during a #{ChefUtils::Dist::Infra::PRODUCT} run. Only use this resource when a command or service exits successfully but is not ready for the next step in a recipe."
|
|
26
26
|
introduced "15.5"
|
|
@@ -28,7 +28,7 @@ class Chef
|
|
|
28
28
|
class CookbookFile < Chef::Resource::File
|
|
29
29
|
include Chef::Mixin::Securable
|
|
30
30
|
|
|
31
|
-
provides :cookbook_file
|
|
31
|
+
provides :cookbook_file
|
|
32
32
|
|
|
33
33
|
description "Use the **cookbook_file** resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{ChefUtils::Dist::Infra::PRODUCT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{ChefUtils::Dist::Infra::PRODUCT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{ChefUtils::Dist::Server::PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{ChefUtils::Dist::Server::PRODUCT} to a node."
|
|
34
34
|
|
|
@@ -28,7 +28,7 @@ class Chef
|
|
|
28
28
|
|
|
29
29
|
use "cron_shared"
|
|
30
30
|
|
|
31
|
-
provides :cron
|
|
31
|
+
provides :cron
|
|
32
32
|
|
|
33
33
|
description "Use the **cron** resource to manage cron entries for time-based job scheduling. Properties for a schedule will default to * if not provided. The cron resource requires access to a crontab program, typically cron. Warning: The cron resource should only be used to modify an entry in a crontab file. The `cron_d` resource directly manages `cron.d` files. This resource ships in #{ChefUtils::Dist::Infra::PRODUCT} 14.4 or later and can also be found in the [cron](https://github.com/chef-cookbooks/cron) cookbook) for previous #{ChefUtils::Dist::Infra::PRODUCT} releases."
|
|
34
34
|
|
|
@@ -26,7 +26,7 @@ class Chef
|
|
|
26
26
|
|
|
27
27
|
use "cron_shared"
|
|
28
28
|
|
|
29
|
-
provides :cron_d
|
|
29
|
+
provides :cron_d
|
|
30
30
|
|
|
31
31
|
introduced "14.4"
|
|
32
32
|
description "Use the **cron_d** resource to manage cron job files in the `/etc/cron.d` directory. Warning: #{ChefUtils::Dist::Infra::PRODUCT} also ships with the **cron** resource for managing the monolithic `/etc/crontab` file on platforms that lack cron.d support. See the [cron resource](/resources/cron/) for information on using that resource."
|
|
@@ -23,7 +23,7 @@ require_relative "../resource"
|
|
|
23
23
|
class Chef
|
|
24
24
|
class Resource
|
|
25
25
|
class CronAccess < Chef::Resource
|
|
26
|
-
provides :cron_access
|
|
26
|
+
provides :cron_access
|
|
27
27
|
provides(:cron_manage) # legacy name @todo in Chef 15 we should { true } this so it wins over the cookbook
|
|
28
28
|
|
|
29
29
|
introduced "14.4"
|
|
@@ -25,7 +25,7 @@ class Chef
|
|
|
25
25
|
class Resource
|
|
26
26
|
class Directory < Chef::Resource
|
|
27
27
|
|
|
28
|
-
provides :directory
|
|
28
|
+
provides :directory
|
|
29
29
|
|
|
30
30
|
description "Use the **directory** resource to manage a directory, which is a hierarchy"\
|
|
31
31
|
" of folders that comprises all of the information stored on a computer."\
|
|
@@ -22,7 +22,7 @@ class Chef
|
|
|
22
22
|
class Resource
|
|
23
23
|
class DpkgPackage < Chef::Resource::Package
|
|
24
24
|
|
|
25
|
-
provides :dpkg_package
|
|
25
|
+
provides :dpkg_package
|
|
26
26
|
|
|
27
27
|
description "Use the **dpkg_package** resource to manage packages for the dpkg platform. When a package is installed from a local file, it must be added to the node using the **remote_file** or **cookbook_file** resources."
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ class Chef
|
|
|
37
37
|
provides :json
|
|
38
38
|
|
|
39
39
|
def verify(path, opts = {})
|
|
40
|
-
Chef::JSONCompat.parse(
|
|
40
|
+
Chef::JSONCompat.parse(IO.read(path))
|
|
41
41
|
true
|
|
42
42
|
rescue Chef::Exceptions::JSON::ParseError => e
|
|
43
43
|
Chef::Log.error("Json syntax verify failed with : #{e.message}")
|
data/lib/chef/resource/file.rb
CHANGED
|
@@ -29,7 +29,7 @@ class Chef
|
|
|
29
29
|
class File < Chef::Resource
|
|
30
30
|
include Chef::Mixin::Securable
|
|
31
31
|
|
|
32
|
-
provides :file
|
|
32
|
+
provides :file
|
|
33
33
|
|
|
34
34
|
description "Use the **file** resource to manage files directly on a node. Note: Use the **cookbook_file** resource to copy a file from a cookbook's `/files` directory. Use the **template** resource to create a file based on a template in a cookbook's `/templates` directory. And use the **remote_file** resource to transfer a file to a node from a remote location."
|
|
35
35
|
|
|
@@ -25,8 +25,8 @@ require_relative "../provider/package/freebsd/pkgng"
|
|
|
25
25
|
class Chef
|
|
26
26
|
class Resource
|
|
27
27
|
class FreebsdPackage < Chef::Resource::Package
|
|
28
|
-
provides :freebsd_package
|
|
29
|
-
provides :package, platform: "freebsd"
|
|
28
|
+
provides :freebsd_package
|
|
29
|
+
provides :package, platform: "freebsd"
|
|
30
30
|
|
|
31
31
|
description "Use the **freebsd_package** resource to manage packages for the FreeBSD platform."
|
|
32
32
|
|
data/lib/chef/resource/group.rb
CHANGED
|
@@ -22,7 +22,7 @@ class Chef
|
|
|
22
22
|
class Resource
|
|
23
23
|
class HabitatPackage < Chef::Resource::Package
|
|
24
24
|
|
|
25
|
-
provides :habitat_package
|
|
25
|
+
provides :habitat_package
|
|
26
26
|
use "habitat_shared"
|
|
27
27
|
description "Use the **habitat_package** to install or remove Chef Habitat packages from Habitat Builder."
|
|
28
28
|
introduced "17.3"
|
|
@@ -21,7 +21,7 @@ class Chef
|
|
|
21
21
|
class Resource
|
|
22
22
|
class HabitatSup < Chef::Resource
|
|
23
23
|
|
|
24
|
-
provides
|
|
24
|
+
provides :habitat_sup do |_node|
|
|
25
25
|
false
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -186,10 +186,10 @@ class Chef
|
|
|
186
186
|
habitat_install new_resource.name do
|
|
187
187
|
license new_resource.license
|
|
188
188
|
hab_version new_resource.sup_version if new_resource.sup_version
|
|
189
|
-
not_if { ::
|
|
190
|
-
not_if { ::
|
|
191
|
-
not_if { ::
|
|
192
|
-
not_if { ::
|
|
189
|
+
not_if { ::File.exist?("/bin/hab") }
|
|
190
|
+
not_if { ::File.exist?("/usr/bin/hab") }
|
|
191
|
+
not_if { ::File.exist?("c:/habitat/hab.exe") }
|
|
192
|
+
not_if { ::File.exist?("c:/ProgramData/Habitat/hab.exe") }
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
habitat_package "core/hab-sup" do
|
|
@@ -205,7 +205,7 @@ class Chef
|
|
|
205
205
|
if windows?
|
|
206
206
|
directory "C:/hab/sup/default/config" do
|
|
207
207
|
recursive true
|
|
208
|
-
only_if { ::
|
|
208
|
+
only_if { ::Dir.exist?("C:/hab") }
|
|
209
209
|
only_if { use_toml_config }
|
|
210
210
|
action :create
|
|
211
211
|
end
|
|
@@ -235,14 +235,14 @@ class Chef
|
|
|
235
235
|
keep_latest_packages: new_resource.keep_latest
|
|
236
236
|
)
|
|
237
237
|
only_if { use_toml_config }
|
|
238
|
-
only_if { ::
|
|
238
|
+
only_if { ::Dir.exist?("C:/hab/sup/default/config") }
|
|
239
239
|
end
|
|
240
240
|
else
|
|
241
241
|
directory "/hab/sup/default/config" do
|
|
242
242
|
mode "0755"
|
|
243
243
|
recursive true
|
|
244
244
|
only_if { use_toml_config }
|
|
245
|
-
only_if { ::
|
|
245
|
+
only_if { ::Dir.exist?("/hab") }
|
|
246
246
|
action :create
|
|
247
247
|
end
|
|
248
248
|
|
|
@@ -271,7 +271,7 @@ class Chef
|
|
|
271
271
|
keep_latest_packages: new_resource.keep_latest
|
|
272
272
|
)
|
|
273
273
|
only_if { use_toml_config }
|
|
274
|
-
only_if { ::
|
|
274
|
+
only_if { ::Dir.exist?("/hab/sup/default/config") }
|
|
275
275
|
end
|
|
276
276
|
end
|
|
277
277
|
end
|
|
@@ -20,8 +20,8 @@ require_relative "habitat_sup"
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class HabitatSupSystemd < HabitatSup
|
|
23
|
-
provides :habitat_sup, os: "linux"
|
|
24
|
-
provides :habitat_sup_systemd
|
|
23
|
+
provides :habitat_sup, os: "linux"
|
|
24
|
+
provides :habitat_sup_systemd
|
|
25
25
|
|
|
26
26
|
action :run do
|
|
27
27
|
super()
|
|
@@ -19,7 +19,7 @@ require_relative "../resource"
|
|
|
19
19
|
class Chef
|
|
20
20
|
class Resource
|
|
21
21
|
class HabitatInstall < Chef::Resource
|
|
22
|
-
provides :habitat_install
|
|
22
|
+
provides :habitat_install
|
|
23
23
|
|
|
24
24
|
description "Use the **habitat_install** resource to install Chef Habitat."
|
|
25
25
|
introduced "17.3"
|
|
@@ -70,7 +70,7 @@ class Chef
|
|
|
70
70
|
description: "Specify the version of `Habitat` you would like to install."
|
|
71
71
|
|
|
72
72
|
action :install, description: "Installs Habitat. Does nothing if the `hab` binary is found in the default location for the system (`/bin/hab` on Linux, `/usr/local/bin/hab` on macOS, `C:/habitat/hab.exe` on Windows)" do
|
|
73
|
-
if ::
|
|
73
|
+
if ::File.exist?(hab_path)
|
|
74
74
|
cmd = shell_out!([hab_path, "--version"].flatten.compact.join(" "))
|
|
75
75
|
version = %r{hab (\d*\.\d*\.\d[^\/]*)}.match(cmd.stdout)[1]
|
|
76
76
|
return if version == new_resource.hab_version
|
|
@@ -94,7 +94,7 @@ class Chef
|
|
|
94
94
|
path habfile
|
|
95
95
|
destination "#{Chef::Config[:file_cache_path]}/habitat"
|
|
96
96
|
action :extract
|
|
97
|
-
not_if { ::
|
|
97
|
+
not_if { ::Dir.exist?("c:\\habitat") }
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
directory "c:\\habitat" do
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#
|
|
19
19
|
|
|
20
20
|
require_relative "../resource"
|
|
21
|
-
require_relative "../mixin/
|
|
21
|
+
require_relative "../mixin/homebrew"
|
|
22
22
|
|
|
23
23
|
class Chef
|
|
24
24
|
class Resource
|
|
@@ -29,7 +29,7 @@ class Chef
|
|
|
29
29
|
description "Use the **homebrew_cask** resource to install binaries distributed via the Homebrew package manager."
|
|
30
30
|
introduced "14.0"
|
|
31
31
|
|
|
32
|
-
include Chef::Mixin::
|
|
32
|
+
include Chef::Mixin::Homebrew
|
|
33
33
|
|
|
34
34
|
property :cask_name, String,
|
|
35
35
|
description: "An optional property to set the cask name if it differs from the resource block's name.",
|
|
@@ -40,10 +40,6 @@ class Chef
|
|
|
40
40
|
property :options, String,
|
|
41
41
|
description: "Options to pass to the brew command during installation."
|
|
42
42
|
|
|
43
|
-
property :install_cask, [TrueClass, FalseClass],
|
|
44
|
-
description: "Automatically install the Homebrew cask tap, if necessary.",
|
|
45
|
-
default: true
|
|
46
|
-
|
|
47
43
|
property :homebrew_path, String,
|
|
48
44
|
description: "The path to the Homebrew binary."
|
|
49
45
|
|
|
@@ -53,37 +49,27 @@ class Chef
|
|
|
53
49
|
default_description: "Calculated default username"\
|
|
54
50
|
|
|
55
51
|
action :install, description: "Install an application that is packaged as a Homebrew cask." do
|
|
56
|
-
if new_resource.install_cask
|
|
57
|
-
homebrew_tap "homebrew/cask" do
|
|
58
|
-
homebrew_path homebrew_bin_path(new_resource.homebrew_path)
|
|
59
|
-
owner new_resource.owner
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
52
|
unless casked?
|
|
64
53
|
converge_by("install cask #{new_resource.cask_name} #{new_resource.options}") do
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
cwd
|
|
54
|
+
execute "install cask #{new_resource.cask_name}" do
|
|
55
|
+
command "#{homebrew_bin_path(new_resource.homebrew_path)} install --cask #{new_resource.cask_name} #{new_resource.options}"
|
|
56
|
+
user new_resource.owner
|
|
57
|
+
cwd ::Dir.home(new_resource.owner)
|
|
58
|
+
login true
|
|
59
|
+
end
|
|
69
60
|
end
|
|
70
61
|
end
|
|
71
62
|
end
|
|
72
63
|
|
|
73
64
|
action :remove, description: "Remove an application that is packaged as a Homebrew cask." do
|
|
74
|
-
if new_resource.install_cask
|
|
75
|
-
homebrew_tap "homebrew/cask" do
|
|
76
|
-
homebrew_path homebrew_bin_path(new_resource.homebrew_path)
|
|
77
|
-
owner new_resource.owner
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
65
|
if casked?
|
|
82
66
|
converge_by("uninstall cask #{new_resource.cask_name}") do
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
cwd
|
|
67
|
+
execute "uninstall cask #{new_resource.cask_name}" do
|
|
68
|
+
command "#{homebrew_bin_path(new_resource.homebrew_path)} uninstall --cask #{new_resource.cask_name}"
|
|
69
|
+
user new_resource.owner
|
|
70
|
+
cwd ::Dir.home(new_resource.owner)
|
|
71
|
+
login true
|
|
72
|
+
end
|
|
87
73
|
end
|
|
88
74
|
end
|
|
89
75
|
end
|
|
@@ -98,10 +84,13 @@ class Chef
|
|
|
98
84
|
# @return [Boolean]
|
|
99
85
|
def casked?
|
|
100
86
|
unscoped_name = new_resource.cask_name.split("/").last
|
|
101
|
-
shell_out!(
|
|
87
|
+
shell_out!(
|
|
88
|
+
"#{homebrew_bin_path(new_resource.homebrew_path)} list --cask 2>/dev/null",
|
|
102
89
|
user: new_resource.owner,
|
|
103
90
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
|
104
|
-
cwd: ::Dir.home(new_resource.owner)
|
|
91
|
+
cwd: ::Dir.home(new_resource.owner),
|
|
92
|
+
login: true
|
|
93
|
+
).stdout.split.include?(unscoped_name)
|
|
105
94
|
end
|
|
106
95
|
end
|
|
107
96
|
end
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#
|
|
19
19
|
|
|
20
20
|
require_relative "../resource"
|
|
21
|
-
require_relative "../mixin/
|
|
21
|
+
require_relative "../mixin/homebrew"
|
|
22
22
|
|
|
23
23
|
class Chef
|
|
24
24
|
class Resource
|
|
@@ -29,7 +29,7 @@ class Chef
|
|
|
29
29
|
description "Use the **homebrew_tap** resource to add additional formula repositories to the Homebrew package manager."
|
|
30
30
|
introduced "14.0"
|
|
31
31
|
|
|
32
|
-
include Chef::Mixin::
|
|
32
|
+
include Chef::Mixin::Homebrew
|
|
33
33
|
|
|
34
34
|
property :tap_name, String,
|
|
35
35
|
description: "An optional property to set the tap name if it differs from the resource block's name.",
|
|
@@ -51,10 +51,13 @@ class Chef
|
|
|
51
51
|
action :tap, description: "Add a Homebrew tap." do
|
|
52
52
|
unless tapped?(new_resource.tap_name)
|
|
53
53
|
converge_by("tap #{new_resource.tap_name}") do
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
execute "tap #{new_resource.tap_name}" do
|
|
55
|
+
command "#{homebrew_bin_path(new_resource.homebrew_path)} tap #{new_resource.tap_name} #{new_resource.url || ""}"
|
|
56
|
+
user new_resource.owner
|
|
57
|
+
default_env true
|
|
58
|
+
cwd ::Dir.home(new_resource.owner)
|
|
59
|
+
login true
|
|
60
|
+
end
|
|
58
61
|
end
|
|
59
62
|
end
|
|
60
63
|
end
|
|
@@ -62,21 +65,33 @@ class Chef
|
|
|
62
65
|
action :untap, description: "Remove a Homebrew tap." do
|
|
63
66
|
if tapped?(new_resource.tap_name)
|
|
64
67
|
converge_by("untap #{new_resource.tap_name}") do
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
execute "untap #{new_resource.tap_name}" do
|
|
69
|
+
command "#{homebrew_bin_path(new_resource.homebrew_path)} untap #{new_resource.tap_name}"
|
|
70
|
+
user new_resource.owner
|
|
71
|
+
default_env true
|
|
72
|
+
cwd ::Dir.home(new_resource.owner)
|
|
73
|
+
login true
|
|
74
|
+
end
|
|
69
75
|
end
|
|
70
76
|
end
|
|
71
77
|
end
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
action_class do
|
|
80
|
+
# Is the passed tap already tapped
|
|
81
|
+
#
|
|
82
|
+
# @return [Boolean]
|
|
83
|
+
def tapped?(name)
|
|
84
|
+
brew_path = ::File.dirname(homebrew_bin_path(new_resource.homebrew_path))
|
|
85
|
+
base_path = [
|
|
86
|
+
"#{brew_path}/../homebrew",
|
|
87
|
+
"#{brew_path}/../Homebrew",
|
|
88
|
+
"/opt/homebrew",
|
|
89
|
+
"/usr/local/Homebrew",
|
|
90
|
+
"/home/linuxbrew/.linuxbrew",
|
|
91
|
+
].filter_map { |x| x if Dir.exist?(x) }.first
|
|
92
|
+
tap_dir = name.gsub("/", "/homebrew-")
|
|
93
|
+
::File.directory?("#{base_path}/Library/Taps/#{tap_dir}")
|
|
94
|
+
end
|
|
80
95
|
end
|
|
81
96
|
end
|
|
82
97
|
end
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
#
|
|
20
20
|
|
|
21
21
|
require_relative "../resource"
|
|
22
|
-
require_relative "../mixin/
|
|
22
|
+
require_relative "../mixin/homebrew"
|
|
23
23
|
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
24
24
|
|
|
25
25
|
class Chef
|
|
26
26
|
class Resource
|
|
27
27
|
class HomebrewUpdate < Chef::Resource
|
|
28
|
-
include Chef::Mixin::
|
|
28
|
+
include Chef::Mixin::Homebrew
|
|
29
29
|
|
|
30
30
|
provides(:homebrew_update) { true }
|
|
31
31
|
|
|
@@ -78,9 +78,9 @@ class Chef
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
execute "brew update" do
|
|
81
|
-
command
|
|
82
|
-
default_env true
|
|
81
|
+
command "#{homebrew_bin_path} update"
|
|
83
82
|
user find_homebrew_uid
|
|
83
|
+
login true
|
|
84
84
|
notifies :touch, "file[#{BREW_STAMP}]", :immediately
|
|
85
85
|
end
|
|
86
86
|
end
|