chef 15.8.23-universal-mingw32 → 15.9.17-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/README.md +1 -1
- data/Rakefile +9 -0
- data/distro/powershell/chef/chef.psm1 +459 -459
- data/distro/templates/powershell/chef/chef.psm1.erb +459 -0
- data/lib/chef/application.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/command_line.rb +5 -5
- data/lib/chef/cookbook/metadata.rb +5 -4
- data/lib/chef/cookbook/synchronizer.rb +1 -0
- data/lib/chef/cookbook_loader.rb +1 -1
- data/lib/chef/data_collector/config_validation.rb +7 -7
- data/lib/chef/deprecated.rb +5 -5
- data/lib/chef/dsl/platform_introspection.rb +2 -2
- data/lib/chef/dsl/reboot_pending.rb +3 -3
- data/lib/chef/http/json_output.rb +1 -1
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap/templates/README.md +2 -2
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
- data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +2 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/core/windows_bootstrap_context.rb +8 -8
- data/lib/chef/knife/data_bag_edit.rb +2 -2
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/environment_compare.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +1 -1
- data/lib/chef/provider/group/usermod.rb +2 -5
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/package/homebrew.rb +1 -2
- data/lib/chef/provider/package/rubygems.rb +1 -1
- data/lib/chef/provider/package/yum/python_helper.rb +2 -2
- data/lib/chef/provider/package/yum/rpm_utils.rb +4 -4
- data/lib/chef/provider/package/zypper.rb +2 -1
- data/lib/chef/provider/remote_file.rb +2 -2
- data/lib/chef/provider/route.rb +4 -4
- data/lib/chef/provider/windows_env.rb +3 -3
- data/lib/chef/resource.rb +7 -2
- data/lib/chef/resource/build_essential.rb +46 -22
- data/lib/chef/resource/cron.rb +1 -1
- data/lib/chef/resource/cron_d.rb +1 -1
- data/lib/chef/resource/execute.rb +1 -1
- data/lib/chef/resource/freebsd_package.rb +0 -3
- data/lib/chef/resource/homebrew_package.rb +1 -2
- data/lib/chef/resource/hostname.rb +2 -2
- data/lib/chef/resource/kernel_module.rb +3 -2
- data/lib/chef/resource/openbsd_package.rb +0 -3
- data/lib/chef/resource/remote_file.rb +1 -1
- data/lib/chef/resource/rhsm_errata.rb +9 -2
- data/lib/chef/resource/rhsm_errata_level.rb +11 -5
- data/lib/chef/resource/rhsm_register.rb +27 -12
- data/lib/chef/resource/swap_file.rb +2 -2
- data/lib/chef/resource/timezone.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +0 -2
- data/lib/chef/resource/windows_share.rb +1 -1
- data/lib/chef/shell/ext.rb +1 -1
- data/lib/chef/util/diff.rb +3 -3
- data/lib/chef/util/selinux.rb +2 -2
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/error.rb +1 -1
- data/lib/chef/win32/registry.rb +1 -1
- data/spec/data/cookbooks/starter/recipes/default.rb +1 -1
- data/spec/data/windows_certificates/base64_test.cer +18 -20
- data/spec/data/windows_certificates/othertest.cer +0 -0
- data/spec/data/windows_certificates/test.cer +0 -0
- data/spec/data/windows_certificates/test.p7b +0 -0
- data/spec/data/windows_certificates/test.pem +18 -19
- data/spec/data/windows_certificates/test.pfx +0 -0
- data/spec/functional/resource/ifconfig_spec.rb +2 -2
- data/spec/functional/resource/windows_certificate_spec.rb +9 -9
- data/spec/functional/resource/windows_service_spec.rb +1 -2
- data/spec/functional/run_lock_spec.rb +7 -1
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/functional/win32/version_info_spec.rb +4 -4
- data/spec/integration/client/client_spec.rb +2 -2
- data/spec/integration/client/exit_code_spec.rb +1 -0
- data/spec/integration/client/ipv6_spec.rb +1 -0
- data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -0
- data/spec/integration/knife/chef_repo_path_spec.rb +1 -0
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -0
- data/spec/integration/knife/chefignore_spec.rb +1 -0
- data/spec/integration/knife/client_bulk_delete_spec.rb +1 -0
- data/spec/integration/knife/client_create_spec.rb +1 -0
- data/spec/integration/knife/client_delete_spec.rb +1 -0
- data/spec/integration/knife/client_key_create_spec.rb +1 -0
- data/spec/integration/knife/client_key_delete_spec.rb +1 -0
- data/spec/integration/knife/client_key_list_spec.rb +1 -0
- data/spec/integration/knife/client_key_show_spec.rb +1 -0
- data/spec/integration/knife/client_list_spec.rb +1 -0
- data/spec/integration/knife/client_show_spec.rb +1 -0
- data/spec/integration/knife/common_options_spec.rb +1 -0
- data/spec/integration/knife/config_get_profile_spec.rb +1 -0
- data/spec/integration/knife/config_get_spec.rb +1 -0
- data/spec/integration/knife/config_list_profiles_spec.rb +1 -0
- data/spec/integration/knife/config_use_profile_spec.rb +1 -0
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -0
- data/spec/integration/knife/cookbook_bulk_delete_spec.rb +1 -0
- data/spec/integration/knife/cookbook_download_spec.rb +1 -0
- data/spec/integration/knife/cookbook_list_spec.rb +1 -0
- data/spec/integration/knife/cookbook_show_spec.rb +1 -0
- data/spec/integration/knife/cookbook_upload_spec.rb +1 -0
- data/spec/integration/knife/data_bag_create_spec.rb +1 -0
- data/spec/integration/knife/data_bag_delete_spec.rb +1 -0
- data/spec/integration/knife/data_bag_edit_spec.rb +1 -0
- data/spec/integration/knife/data_bag_from_file_spec.rb +1 -0
- data/spec/integration/knife/data_bag_list_spec.rb +1 -0
- data/spec/integration/knife/data_bag_show_spec.rb +1 -0
- data/spec/integration/knife/delete_spec.rb +1 -0
- data/spec/integration/knife/deps_spec.rb +3 -2
- data/spec/integration/knife/diff_spec.rb +1 -0
- data/spec/integration/knife/download_spec.rb +1 -0
- data/spec/integration/knife/environment_compare_spec.rb +1 -0
- data/spec/integration/knife/environment_create_spec.rb +1 -0
- data/spec/integration/knife/environment_delete_spec.rb +1 -0
- data/spec/integration/knife/environment_from_file_spec.rb +1 -0
- data/spec/integration/knife/environment_list_spec.rb +1 -0
- data/spec/integration/knife/environment_show_spec.rb +1 -0
- data/spec/integration/knife/list_spec.rb +1 -0
- data/spec/integration/knife/node_bulk_delete_spec.rb +1 -0
- data/spec/integration/knife/node_create_spec.rb +1 -0
- data/spec/integration/knife/node_delete_spec.rb +1 -0
- data/spec/integration/knife/node_environment_set_spec.rb +1 -0
- data/spec/integration/knife/node_from_file_spec.rb +1 -0
- data/spec/integration/knife/node_list_spec.rb +1 -0
- data/spec/integration/knife/node_run_list_add_spec.rb +1 -0
- data/spec/integration/knife/node_run_list_remove_spec.rb +1 -0
- data/spec/integration/knife/node_run_list_set_spec.rb +1 -0
- data/spec/integration/knife/node_show_spec.rb +1 -0
- data/spec/integration/knife/raw_spec.rb +1 -0
- data/spec/integration/knife/redirection_spec.rb +1 -0
- data/spec/integration/knife/role_bulk_delete_spec.rb +1 -0
- data/spec/integration/knife/role_create_spec.rb +1 -0
- data/spec/integration/knife/role_delete_spec.rb +1 -0
- data/spec/integration/knife/role_from_file_spec.rb +1 -0
- data/spec/integration/knife/role_list_spec.rb +1 -0
- data/spec/integration/knife/role_show_spec.rb +1 -0
- data/spec/integration/knife/search_node_spec.rb +1 -0
- data/spec/integration/knife/show_spec.rb +1 -0
- data/spec/integration/knife/upload_spec.rb +1 -0
- data/spec/integration/recipes/accumulator_spec.rb +1 -0
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -0
- data/spec/integration/recipes/lwrp_spec.rb +1 -0
- data/spec/integration/recipes/notifies_spec.rb +1 -0
- data/spec/integration/recipes/notifying_block_spec.rb +1 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -0
- data/spec/integration/recipes/resource_action_spec.rb +1 -0
- data/spec/integration/recipes/unified_mode_spec.rb +1 -0
- data/spec/integration/solo/solo_spec.rb +1 -0
- data/spec/spec_helper.rb +7 -10
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/key_helpers.rb +0 -2
- data/spec/support/platform_helpers.rb +7 -3
- data/spec/support/platforms/win32/spec_service.rb +27 -25
- data/spec/support/shared/context/config.rb +0 -3
- data/spec/support/shared/integration/integration_helper.rb +0 -1
- data/spec/support/shared/unit/execute_resource.rb +0 -2
- data/spec/support/shared/unit/provider/file.rb +0 -1
- data/spec/support/shared/unit/script_resource.rb +2 -4
- data/spec/support/shared/unit/windows_script_resource.rb +0 -2
- data/spec/unit/cookbook/gem_installer_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +1 -10
- data/spec/unit/data_collector_spec.rb +1 -1
- data/spec/unit/deprecated_spec.rb +3 -3
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +1 -1
- data/spec/unit/encrypted_data_bag_item_spec.rb +2 -2
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +3 -3
- data/spec/unit/knife_spec.rb +6 -7
- data/spec/unit/mixin/shell_out_spec.rb +27 -29
- data/spec/unit/provider/file_spec.rb +1 -0
- data/spec/unit/resource/build_essential_spec.rb +48 -2
- data/spec/unit/resource/data/InstallHistory_with_CLT.plist +92 -0
- data/spec/unit/resource/data/InstallHistory_without_CLT.plist +38 -0
- data/spec/unit/resource/execute_spec.rb +1 -1
- data/spec/unit/resource/rhsm_register_spec.rb +24 -0
- data/spec/unit/resource/windows_share_spec.rb +3 -1
- data/tasks/rspec.rb +1 -0
- metadata +9 -6
@@ -2,8 +2,7 @@
|
|
2
2
|
# Author:: Joshua Timberman (<joshua@chef.io>)
|
3
3
|
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
4
4
|
#
|
5
|
-
# Copyright 2011-2016, Chef Software Inc.
|
6
|
-
# Copyright 2014-2016, Chef Software, Inc <legal@chef.io>
|
5
|
+
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
|
7
6
|
#
|
8
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
8
|
# you may not use this file except in compliance with the License.
|
@@ -403,7 +403,7 @@ class Chef
|
|
403
403
|
"Gem options must be passed to gem_package as a string instead of a hash when",
|
404
404
|
"using this installation of #{Chef::Dist::PRODUCT} because it runs with its own packaged Ruby. A hash",
|
405
405
|
"may only be used when installing a gem to the same Ruby installation that #{Chef::Dist::PRODUCT} is",
|
406
|
-
"running under.
|
406
|
+
"running under. See https://docs.chef.io/resources/gem_package/ for more information.",
|
407
407
|
"Error raised at #{new_resource} from #{new_resource.source_line}",
|
408
408
|
].join("\n")
|
409
409
|
raise ArgumentError, msg
|
@@ -209,9 +209,9 @@ class Chef
|
|
209
209
|
|
210
210
|
# the most unprocessed characters left wins
|
211
211
|
if (x_pos_max - x_pos) > (y_pos_max - y_pos)
|
212
|
-
|
212
|
+
1
|
213
213
|
else
|
214
|
-
|
214
|
+
-1
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
@@ -522,9 +522,9 @@ class Chef
|
|
522
522
|
def lookup(package_name)
|
523
523
|
pkgs = @rpms[package_name]
|
524
524
|
if pkgs
|
525
|
-
|
525
|
+
pkgs.sort.reverse
|
526
526
|
else
|
527
|
-
|
527
|
+
nil
|
528
528
|
end
|
529
529
|
end
|
530
530
|
|
@@ -3,7 +3,8 @@
|
|
3
3
|
# Authors:: Adam Jacob (<adam@chef.io>)
|
4
4
|
# Ionuț Arțăriși (<iartarisi@suse.cz>)
|
5
5
|
# Copyright:: Copyright 2008-2017, Chef Software Inc.
|
6
|
-
#
|
6
|
+
# Copyright:: 2013-2016, SUSE Linux GmbH
|
7
|
+
#
|
7
8
|
# License:: Apache License, Version 2.0
|
8
9
|
#
|
9
10
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Jesse Campbell (<hikeit@gmail.com>)
|
3
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2020, 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,7 +35,7 @@ class Chef
|
|
35
35
|
requirements.assert(:all_actions) do |a|
|
36
36
|
a.assertion do
|
37
37
|
if prop
|
38
|
-
|
38
|
+
windows?
|
39
39
|
else
|
40
40
|
true
|
41
41
|
end
|
data/lib/chef/provider/route.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan (btm@loftninjas.org), Jesse Nelson (spheromak@gmail.com)
|
3
3
|
# Copyright:: Copyright 2009-2016, Bryan McLellan
|
4
|
+
# Copyright:: Copyright 2020, Chef Software, Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -78,7 +79,7 @@ class Chef
|
|
78
79
|
IPAddr.new(ip, Socket::AF_INET).to_s
|
79
80
|
rescue ArgumentError
|
80
81
|
logger.trace("Invalid IP address data: hex=#{hex_ip}, ip=#{ip}")
|
81
|
-
|
82
|
+
nil
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
@@ -95,7 +96,7 @@ class Chef
|
|
95
96
|
end
|
96
97
|
|
97
98
|
# For linux, we use /proc/net/route file to read proc table info
|
98
|
-
return
|
99
|
+
return unless linux?
|
99
100
|
|
100
101
|
route_file = ::File.open("/proc/net/route", "r")
|
101
102
|
|
@@ -159,8 +160,7 @@ class Chef
|
|
159
160
|
end
|
160
161
|
|
161
162
|
def generate_config
|
162
|
-
|
163
|
-
when "rhel", "amazon", "fedora"
|
163
|
+
if platform_family?("rhel", "amazon", "fedora")
|
164
164
|
conf = {}
|
165
165
|
# walk the collection
|
166
166
|
run_context.resource_collection.each do |resource|
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
needs_delete = new_values.any? { |v| current_values.include?(v) }
|
105
105
|
if !needs_delete
|
106
106
|
logger.trace("#{new_resource} element '#{new_resource.value}' does not exist")
|
107
|
-
|
107
|
+
true # do not delete the key
|
108
108
|
else
|
109
109
|
new_value =
|
110
110
|
current_values.select do |item|
|
@@ -112,13 +112,13 @@ class Chef
|
|
112
112
|
end.join(new_resource.delim)
|
113
113
|
|
114
114
|
if new_value.empty?
|
115
|
-
|
115
|
+
false # nothing left here, delete the key
|
116
116
|
else
|
117
117
|
old_value = new_resource.value(new_value)
|
118
118
|
create_env
|
119
119
|
logger.trace("#{new_resource} deleted #{old_value} element")
|
120
120
|
new_resource.updated_by_last_action(true)
|
121
|
-
|
121
|
+
true # we removed the element and updated; do not delete the key
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
data/lib/chef/resource.rb
CHANGED
@@ -965,6 +965,8 @@ class Chef
|
|
965
965
|
@resource_name = nil
|
966
966
|
end
|
967
967
|
end
|
968
|
+
|
969
|
+
@resource_name = nil unless defined?(@resource_name)
|
968
970
|
@resource_name
|
969
971
|
end
|
970
972
|
|
@@ -990,7 +992,7 @@ class Chef
|
|
990
992
|
# @param flag [Boolean] value to set unified_mode to
|
991
993
|
# @return [Boolean] unified_mode value
|
992
994
|
def self.unified_mode(flag = nil)
|
993
|
-
@unified_mode = Chef::Config[:resource_unified_mode_default] if @unified_mode.nil?
|
995
|
+
@unified_mode = Chef::Config[:resource_unified_mode_default] if !defined?(@unified_mode) || @unified_mode.nil?
|
994
996
|
@unified_mode = flag unless flag.nil?
|
995
997
|
!!@unified_mode
|
996
998
|
end
|
@@ -1035,7 +1037,7 @@ class Chef
|
|
1035
1037
|
self.allowed_actions |= @default_action
|
1036
1038
|
end
|
1037
1039
|
|
1038
|
-
if @default_action
|
1040
|
+
if defined?(@default_action) && @default_action
|
1039
1041
|
@default_action
|
1040
1042
|
elsif superclass.respond_to?(:default_action)
|
1041
1043
|
superclass.default_action
|
@@ -1366,6 +1368,9 @@ class Chef
|
|
1366
1368
|
def self.provides(name, **options, &block)
|
1367
1369
|
name = name.to_sym
|
1368
1370
|
|
1371
|
+
# quell warnings
|
1372
|
+
@chef_version_for_provides = nil unless defined?(@chef_version_for_provides)
|
1373
|
+
|
1369
1374
|
# `provides :resource_name, os: 'linux'`) needs to remove the old
|
1370
1375
|
# canonical DSL before adding the new one.
|
1371
1376
|
if @resource_name && name == @resource_name
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require_relative "../resource"
|
18
|
+
require "plist"
|
18
19
|
|
19
20
|
class Chef
|
20
21
|
class Resource
|
@@ -67,23 +68,7 @@ class Chef
|
|
67
68
|
package "devel/m4"
|
68
69
|
package "devel/gettext"
|
69
70
|
when macos?
|
70
|
-
unless xcode_cli_installed?
|
71
|
-
# This script was graciously borrowed and modified from Tim Sutton's
|
72
|
-
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
|
73
|
-
execute "install XCode Command Line tools" do
|
74
|
-
command <<-EOH.gsub(/^ {14}/, "")
|
75
|
-
# create the placeholder file that's checked by CLI updates' .dist code
|
76
|
-
# in Apple's SUS catalog
|
77
|
-
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
78
|
-
# find the CLI Tools update. We tail here because sometimes there's 2 and newest is last
|
79
|
-
PROD=$(softwareupdate -l | grep "\*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
|
80
|
-
# install it
|
81
|
-
softwareupdate -i "$PROD" --verbose
|
82
|
-
# Remove the placeholder to prevent perpetual appearance in the update utility
|
83
|
-
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
84
|
-
EOH
|
85
|
-
end
|
86
|
-
end
|
71
|
+
install_xcode_cli_tools(xcode_cli_package_label) unless xcode_cli_installed?
|
87
72
|
when omnios?
|
88
73
|
package "developer/gcc48"
|
89
74
|
package "developer/object-file"
|
@@ -142,14 +127,53 @@ class Chef
|
|
142
127
|
|
143
128
|
action_class do
|
144
129
|
#
|
145
|
-
#
|
130
|
+
# Install Xcode Command Line tools via softwareupdate CLI
|
131
|
+
#
|
132
|
+
# @param [String] label The label (package name) to install
|
133
|
+
#
|
134
|
+
def install_xcode_cli_tools(label)
|
135
|
+
# This script was graciously borrowed and modified from Tim Sutton's
|
136
|
+
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
|
137
|
+
|
138
|
+
if label.nil?
|
139
|
+
Chef::Log.warn("Could not determine a Xcode CLI Tools package to install via softwareupdate")
|
140
|
+
else
|
141
|
+
# create the placeholder file that's checked by CLI updates' .dist code
|
142
|
+
# in Apple's SUS catalog and then remove it when we're done
|
143
|
+
execute "install Xcode Command Line tools" do
|
144
|
+
command <<-EOH
|
145
|
+
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
146
|
+
softwareupdate -i "#{label}" --verbose
|
147
|
+
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
148
|
+
EOH
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# Determine if the XCode Command Line Tools are installed by parsing the install history plist.
|
155
|
+
# We parse the plist data install of running pkgutil because we found that pkgutils doesn't always contain all the packages
|
146
156
|
#
|
147
157
|
# @return [true, false]
|
148
158
|
def xcode_cli_installed?
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
159
|
+
packages = Plist.parse_xml(::File.open("/Library/Receipts/InstallHistory.plist", "r"))
|
160
|
+
packages.select! { |package| package["displayName"].match? "Command Line Tools" }
|
161
|
+
!packages.empty?
|
162
|
+
end
|
163
|
+
|
164
|
+
#
|
165
|
+
# Return to package label of the latest Xcode Command Line Tools update, if available
|
166
|
+
#
|
167
|
+
# @return [String, NilClass]
|
168
|
+
def xcode_cli_package_label
|
169
|
+
available_updates = shell_out("softwareupdate", "--list")
|
170
|
+
|
171
|
+
# raise if we fail to check
|
172
|
+
available_updates.error!
|
173
|
+
|
174
|
+
# https://rubular.com/r/UPEE5P7mZLvXNs
|
175
|
+
# this will return the match or nil
|
176
|
+
available_updates.stdout[/^\s*\* (?:Label: )?(Command Line Tools.*)/, 1]
|
153
177
|
end
|
154
178
|
end
|
155
179
|
|
data/lib/chef/resource/cron.rb
CHANGED
@@ -135,7 +135,7 @@ class Chef
|
|
135
135
|
end
|
136
136
|
|
137
137
|
property :time, Symbol,
|
138
|
-
description: "A time interval.
|
138
|
+
description: "A time interval.",
|
139
139
|
equal_to: Chef::Provider::Cron::SPECIAL_TIME_VALUES
|
140
140
|
|
141
141
|
property :mailto, String,
|
data/lib/chef/resource/cron_d.rb
CHANGED
@@ -146,7 +146,7 @@ class Chef
|
|
146
146
|
property :cookbook, String, desired_state: false
|
147
147
|
|
148
148
|
property :predefined_value, String,
|
149
|
-
description:
|
149
|
+
description: "Schedule your cron job with one of the special predefined value instead of ** * pattern.",
|
150
150
|
equal_to: %w{ @reboot @yearly @annually @monthly @weekly @daily @midnight @hourly }
|
151
151
|
|
152
152
|
property :minute, [Integer, String],
|
@@ -131,7 +131,7 @@ class Chef
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def validate_identity_platform(specified_user, password = nil, specified_domain = nil, elevated = false)
|
134
|
-
if
|
134
|
+
if windows?
|
135
135
|
if specified_user && password.nil?
|
136
136
|
raise ArgumentError, "A value for `password` must be specified when a value for `user` is specified on the Windows platform"
|
137
137
|
end
|
@@ -21,13 +21,10 @@
|
|
21
21
|
require_relative "package"
|
22
22
|
require_relative "../provider/package/freebsd/port"
|
23
23
|
require_relative "../provider/package/freebsd/pkgng"
|
24
|
-
require_relative "../mixin/shell_out"
|
25
24
|
|
26
25
|
class Chef
|
27
26
|
class Resource
|
28
27
|
class FreebsdPackage < Chef::Resource::Package
|
29
|
-
include Chef::Mixin::ShellOut
|
30
|
-
|
31
28
|
resource_name :freebsd_package
|
32
29
|
provides :package, platform: "freebsd"
|
33
30
|
|
@@ -2,8 +2,7 @@
|
|
2
2
|
# Author:: Joshua Timberman (<joshua@chef.io>)
|
3
3
|
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
4
4
|
#
|
5
|
-
# Copyright 2011-
|
6
|
-
# Copyright 2014-2016, Chef Software, Inc <legal@chef.io>
|
5
|
+
# Copyright:: 2011-2020, Chef Software Inc.<legal@chef.io>
|
7
6
|
#
|
8
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
8
|
# you may not use this file except in compliance with the License.
|
@@ -82,7 +82,7 @@ class Chef
|
|
82
82
|
action :set do
|
83
83
|
description "Sets the node's hostname."
|
84
84
|
|
85
|
-
if
|
85
|
+
if !windows?
|
86
86
|
ohai "reload hostname" do
|
87
87
|
plugin "hostname"
|
88
88
|
action :nothing
|
@@ -125,7 +125,7 @@ class Chef
|
|
125
125
|
not_if { shell_out!("/usr/sbin/scutil --get LocalHostName").stdout.chomp == shortname }
|
126
126
|
notifies :reload, "ohai[reload hostname]"
|
127
127
|
end
|
128
|
-
when
|
128
|
+
when linux?
|
129
129
|
case
|
130
130
|
when ::File.exist?("/usr/bin/hostnamectl") && !docker?
|
131
131
|
# use hostnamectl whenever we find it on linux (as systemd takes over the world)
|
@@ -21,13 +21,10 @@
|
|
21
21
|
|
22
22
|
require_relative "package"
|
23
23
|
require_relative "../provider/package/openbsd"
|
24
|
-
require_relative "../mixin/shell_out"
|
25
24
|
|
26
25
|
class Chef
|
27
26
|
class Resource
|
28
27
|
class OpenbsdPackage < Chef::Resource::Package
|
29
|
-
include Chef::Mixin::ShellOut
|
30
|
-
|
31
28
|
resource_name :openbsd_package
|
32
29
|
provides :package, os: "openbsd"
|
33
30
|
|
@@ -109,7 +109,7 @@ class Chef
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def validate_identity_platform(specified_user, password = nil, specified_domain = nil)
|
112
|
-
if
|
112
|
+
if windows?
|
113
113
|
if specified_user && password.nil?
|
114
114
|
raise ArgumentError, "A value for `remote_password` must be specified when a value for `user` is specified on the Windows platform"
|
115
115
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2015-
|
2
|
+
# Copyright:: 2015-2020 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");
|
@@ -20,6 +20,7 @@ require_relative "../resource"
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class RhsmErrata < Chef::Resource
|
23
|
+
unified_mode true
|
23
24
|
resource_name :rhsm_errata
|
24
25
|
provides(:rhsm_errata) { true }
|
25
26
|
|
@@ -36,11 +37,17 @@ class Chef
|
|
36
37
|
description "Installs a package for a specific errata ID."
|
37
38
|
|
38
39
|
execute "Install errata packages for #{new_resource.errata_id}" do
|
39
|
-
command "
|
40
|
+
command "#{package_manager_command} update --advisory #{new_resource.errata_id} -y"
|
40
41
|
default_env true
|
41
42
|
action :run
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
action_class do
|
47
|
+
def package_manager_command
|
48
|
+
node["platform_version"].to_i >= 8 ? "dnf" : "yum"
|
49
|
+
end
|
50
|
+
end
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2015-
|
2
|
+
# Copyright:: 2015-2020 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");
|
@@ -20,6 +20,7 @@ require_relative "../resource"
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class RhsmErrataLevel < Chef::Resource
|
23
|
+
unified_mode true
|
23
24
|
resource_name :rhsm_errata_level
|
24
25
|
provides(:rhsm_errata_level) { true }
|
25
26
|
|
@@ -35,17 +36,22 @@ class Chef
|
|
35
36
|
action :install do
|
36
37
|
description "Install all packages of the specified errata level."
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
only_if { node["platform_version"].to_i == 6 }
|
39
|
+
if rhel6?
|
40
|
+
yum_package "yum-plugin-security"
|
41
41
|
end
|
42
42
|
|
43
43
|
execute "Install any #{new_resource.errata_level} errata" do
|
44
|
-
command "
|
44
|
+
command "#{package_manager_command} update --sec-severity=#{new_resource.errata_level.capitalize} -y"
|
45
45
|
default_env true
|
46
46
|
action :run
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
action_class do
|
51
|
+
def package_manager_command
|
52
|
+
node["platform_version"].to_i >= 8 ? "dnf" : "yum"
|
53
|
+
end
|
54
|
+
end
|
49
55
|
end
|
50
56
|
end
|
51
57
|
end
|