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
data/lib/chef/application.rb
CHANGED
@@ -19,7 +19,6 @@
|
|
19
19
|
require "pp" unless defined?(PP)
|
20
20
|
require "socket" unless defined?(Socket)
|
21
21
|
require_relative "config"
|
22
|
-
require_relative "config_fetcher"
|
23
22
|
require_relative "exceptions"
|
24
23
|
require_relative "local_mode"
|
25
24
|
require_relative "log"
|
@@ -119,6 +118,7 @@ class Chef
|
|
119
118
|
|
120
119
|
# @api private (test injection)
|
121
120
|
def chef_configfetcher
|
121
|
+
require_relative "config_fetcher"
|
122
122
|
Chef::ConfigFetcher
|
123
123
|
end
|
124
124
|
|
@@ -190,9 +190,9 @@ class Chef
|
|
190
190
|
are_same, old_value, new_value = Chef::ChefFS::FileSystem.compare(old_entry, new_entry)
|
191
191
|
if are_same
|
192
192
|
if old_value == :none
|
193
|
-
|
193
|
+
[ [ :both_nonexistent, old_entry, new_entry ] ]
|
194
194
|
else
|
195
|
-
|
195
|
+
[ [ :same, old_entry, new_entry ] ]
|
196
196
|
end
|
197
197
|
else
|
198
198
|
if old_value == :none
|
@@ -235,11 +235,11 @@ class Chef
|
|
235
235
|
end
|
236
236
|
|
237
237
|
if old_value == :none || (old_value.nil? && !old_entry.exists?)
|
238
|
-
|
238
|
+
[ [ :added, old_entry, new_entry, old_value, new_value ] ]
|
239
239
|
elsif new_value == :none
|
240
|
-
|
240
|
+
[ [ :deleted, old_entry, new_entry, old_value, new_value ] ]
|
241
241
|
else
|
242
|
-
|
242
|
+
[ [ :modified, old_entry, new_entry, old_value, new_value ] ]
|
243
243
|
end
|
244
244
|
end
|
245
245
|
end
|
@@ -604,7 +604,7 @@ class Chef
|
|
604
604
|
msg = <<~OBSOLETED
|
605
605
|
The dependency specification syntax you are using is no longer valid. You may not
|
606
606
|
specify more than one version constraint for a particular cookbook.
|
607
|
-
Consult https://docs.chef.io/config_rb_metadata
|
607
|
+
Consult https://docs.chef.io/config_rb_metadata/ for the updated syntax.
|
608
608
|
|
609
609
|
Called by: #{caller_name} '#{dep_name}', #{version_constraints.map(&:inspect).join(", ")}
|
610
610
|
Called from:
|
@@ -621,9 +621,10 @@ class Chef
|
|
621
621
|
|
622
622
|
msg = <<~INVALID
|
623
623
|
The version constraint syntax you are using is not valid. If you recently
|
624
|
-
upgraded
|
625
|
-
'less than' and 'greater than'; use '<' and
|
626
|
-
Consult https://docs.chef.io/config_rb_metadata
|
624
|
+
upgraded from Chef Infra releases before 0.10, be aware that you no may
|
625
|
+
longer use "<<" and ">>" for 'less than' and 'greater than'; use '<' and
|
626
|
+
'>' instead. Consult https://docs.chef.io/config_rb_metadata/ for more
|
627
|
+
information.
|
627
628
|
|
628
629
|
Called by: #{caller_name} '#{dep_name}', '#{constraint_str}'
|
629
630
|
Called from:
|
data/lib/chef/cookbook_loader.rb
CHANGED
@@ -88,7 +88,7 @@ class Chef
|
|
88
88
|
# @return [Chef::CookbookVersion]
|
89
89
|
def load_cookbook(cookbook_name)
|
90
90
|
unless cookbook_version_loaders.key?(cookbook_name)
|
91
|
-
raise Exceptions::CookbookNotFoundInRepo, "Cannot find a cookbook named #{cookbook_name}; did you forget to add metadata to a cookbook? (https://docs.chef.io/config_rb_metadata
|
91
|
+
raise Exceptions::CookbookNotFoundInRepo, "Cannot find a cookbook named #{cookbook_name}; did you forget to add metadata to a cookbook? (https://docs.chef.io/config_rb_metadata/)"
|
92
92
|
end
|
93
93
|
|
94
94
|
return cookbooks_by_name[cookbook_name] if cookbooks_by_name.key?(cookbook_name)
|
@@ -77,27 +77,27 @@ class Chef
|
|
77
77
|
case
|
78
78
|
when Chef::Config[:why_run]
|
79
79
|
Chef::Log.trace("data collector is disabled for why run mode")
|
80
|
-
|
80
|
+
false
|
81
81
|
when (want_mode != :both) && running_mode != want_mode
|
82
82
|
Chef::Log.trace("data collector is configured to only run in #{Chef::Config[:data_collector][:mode]} modes, disabling it")
|
83
|
-
|
83
|
+
false
|
84
84
|
when !(Chef::Config[:data_collector][:server_url] || Chef::Config[:data_collector][:output_locations])
|
85
85
|
Chef::Log.trace("Neither data collector URL or output locations have been configured, disabling data collector")
|
86
|
-
|
86
|
+
false
|
87
87
|
when running_mode == :client && Chef::Config[:data_collector][:token]
|
88
88
|
Chef::Log.warn("Data collector token authentication is not recommended for client-server mode. " \
|
89
89
|
"Please upgrade #{Chef::Dist::SERVER_PRODUCT} to 12.11 or later and remove the token from your config file " \
|
90
90
|
"to use key based authentication instead")
|
91
|
-
|
91
|
+
true
|
92
92
|
when Chef::Config[:data_collector][:output_locations] && Chef::Config[:data_collector][:output_locations][:files] && !Chef::Config[:data_collector][:output_locations][:files].empty?
|
93
93
|
# we can run fine to a file without a token, even in solo mode.
|
94
|
-
|
94
|
+
true
|
95
95
|
when running_mode == :solo && !Chef::Config[:data_collector][:token]
|
96
96
|
# we are in solo mode and are not logging to a file, so must have a token
|
97
97
|
Chef::Log.trace("Data collector token must be configured to use #{Chef::Dist::AUTOMATE} data collector with #{Chef::Dist::SOLO}")
|
98
|
-
|
98
|
+
false
|
99
99
|
else
|
100
|
-
|
100
|
+
true
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
data/lib/chef/deprecated.rb
CHANGED
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
#
|
48
48
|
# @return [String]
|
49
49
|
def url
|
50
|
-
"#{BASE_URL}#{self.class.doc_page}"
|
50
|
+
"#{BASE_URL}#{self.class.doc_page}/"
|
51
51
|
end
|
52
52
|
|
53
53
|
# Render the user-visible message for this deprecation.
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
#
|
105
105
|
# @example
|
106
106
|
# class MyDeprecation < Base
|
107
|
-
# target 123, "my_deprecation
|
107
|
+
# target 123, "my_deprecation"
|
108
108
|
# end
|
109
109
|
# @param id [Integer] Deprecation ID number. This must be unique among
|
110
110
|
# all deprecations.
|
@@ -113,7 +113,7 @@ class Chef
|
|
113
113
|
# @return [void]
|
114
114
|
def target(id, page = nil)
|
115
115
|
@deprecation_id = id
|
116
|
-
@doc_page = page || "#{deprecation_key}
|
116
|
+
@doc_page = page || "#{deprecation_key}"
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
@@ -137,7 +137,7 @@ class Chef
|
|
137
137
|
end
|
138
138
|
|
139
139
|
class CustomResource < Base
|
140
|
-
target 5, "custom_resource_cleanups
|
140
|
+
target 5, "custom_resource_cleanups"
|
141
141
|
end
|
142
142
|
|
143
143
|
class EasyInstall < Base
|
@@ -235,7 +235,7 @@ class Chef
|
|
235
235
|
|
236
236
|
class Generic < Base
|
237
237
|
def url
|
238
|
-
"https://docs.chef.io/chef_deprecations_client
|
238
|
+
"https://docs.chef.io/chef_deprecations_client/"
|
239
239
|
end
|
240
240
|
|
241
241
|
def to_s
|
@@ -90,9 +90,9 @@ class Chef
|
|
90
90
|
|
91
91
|
case key_matches.length
|
92
92
|
when 0
|
93
|
-
|
93
|
+
nil
|
94
94
|
when 1
|
95
|
-
|
95
|
+
@values[platform][key_matches.first]
|
96
96
|
else
|
97
97
|
raise "Multiple matches detected for #{platform} with values #{@values}. The matches are: #{key_matches}"
|
98
98
|
end
|
@@ -39,11 +39,11 @@ class Chef
|
|
39
39
|
# http://technet.microsoft.com/en-us/library/cc960241.aspx
|
40
40
|
registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }) ||
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
# RebootRequired key contains Update IDs with a value of 1 if they require a reboot.
|
43
|
+
# The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update
|
44
44
|
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') ||
|
45
45
|
|
46
|
-
|
46
|
+
# Vista + Server 2008 and newer may have reboots pending from CBS
|
47
47
|
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
|
48
48
|
elsif platform?("ubuntu")
|
49
49
|
# This should work for Debian as well if update-notifier-common happens to be installed. We need an API for that.
|
@@ -65,7 +65,7 @@ class Chef
|
|
65
65
|
if http_response.body
|
66
66
|
Chef::Log.trace("Response body contains:\n#{http_response.body.length < 256 ? http_response.body : http_response.body[0..256] + " [...truncated...]"}")
|
67
67
|
end
|
68
|
-
|
68
|
+
[http_response, rest_request, http_response.body.to_s]
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/chef/knife.rb
CHANGED
@@ -191,7 +191,7 @@ class Chef
|
|
191
191
|
config_loader.profile = profile
|
192
192
|
config_loader.load
|
193
193
|
|
194
|
-
ui.warn("No knife configuration file found. See https://docs.chef.io/
|
194
|
+
ui.warn("No knife configuration file found. See https://docs.chef.io/config_rb/ for details.") if config_loader.no_config_found?
|
195
195
|
|
196
196
|
config_loader
|
197
197
|
rescue Exceptions::ConfigurationError => e
|
@@ -5,7 +5,7 @@ standardized on the [Omnibus](https://github.com/chef/omnibus) built installatio
|
|
5
5
|
packages.
|
6
6
|
|
7
7
|
The 'chef-full' template downloads a script which is used to determine the correct
|
8
|
-
Omnibus package for this system from the [Omnitruck](https://docs.chef.io/api_omnitruck
|
8
|
+
Omnibus package for this system from the [Omnitruck](https://docs.chef.io/api_omnitruck/) API.
|
9
9
|
|
10
10
|
You can still utilize custom bootstrap templates on your system if your installation
|
11
|
-
needs are unique. Additional information can be found on the [docs site](https://docs.chef.io/knife_bootstrap
|
11
|
+
needs are unique. Additional information can be found on the [docs site](https://docs.chef.io/knife_bootstrap/#custom-templates).
|
@@ -185,50 +185,50 @@ if test "x$tmp_dir" != "x"; then
|
|
185
185
|
rm -r "$tmp_dir"
|
186
186
|
fi
|
187
187
|
|
188
|
-
mkdir -p
|
188
|
+
mkdir -p <%= ChefConfig::Config.etc_chef_dir(false) %>
|
189
189
|
|
190
190
|
<% if client_pem -%>
|
191
|
-
(umask 077 && (cat >
|
191
|
+
(umask 077 && (cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/client.pem <<'EOP'
|
192
192
|
<%= ::File.read(::File.expand_path(client_pem)) %>
|
193
193
|
EOP
|
194
194
|
)) || exit 1
|
195
195
|
<% end -%>
|
196
196
|
|
197
197
|
<% if validation_key -%>
|
198
|
-
(umask 077 && (cat >
|
198
|
+
(umask 077 && (cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/validation.pem <<'EOP'
|
199
199
|
<%= validation_key %>
|
200
200
|
EOP
|
201
201
|
)) || exit 1
|
202
202
|
<% end -%>
|
203
203
|
|
204
204
|
<% if encrypted_data_bag_secret -%>
|
205
|
-
(umask 077 && (cat >
|
205
|
+
(umask 077 && (cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/encrypted_data_bag_secret <<'EOP'
|
206
206
|
<%= encrypted_data_bag_secret %>
|
207
207
|
EOP
|
208
208
|
)) || exit 1
|
209
209
|
<% end -%>
|
210
210
|
|
211
211
|
<% unless trusted_certs.empty? -%>
|
212
|
-
mkdir -p
|
212
|
+
mkdir -p <%= ChefConfig::Config.etc_chef_dir(false) %>/trusted_certs
|
213
213
|
<%= trusted_certs %>
|
214
214
|
<% end -%>
|
215
215
|
|
216
216
|
<%# Generate Ohai Hints -%>
|
217
217
|
<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
|
218
|
-
mkdir -p
|
218
|
+
mkdir -p <%= ChefConfig::Config.etc_chef_dir(false) %>/ohai/hints
|
219
219
|
|
220
220
|
<% @chef_config[:knife][:hints].each do |name, hash| -%>
|
221
|
-
cat >
|
221
|
+
cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/ohai/hints/<%= name %>.json <<'EOP'
|
222
222
|
<%= Chef::JSONCompat.to_json(hash) %>
|
223
223
|
EOP
|
224
224
|
<% end -%>
|
225
225
|
<% end -%>
|
226
226
|
|
227
|
-
cat >
|
227
|
+
cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/client.rb <<'EOP'
|
228
228
|
<%= config_content %>
|
229
229
|
EOP
|
230
230
|
|
231
|
-
cat >
|
231
|
+
cat > <%= ChefConfig::Config.etc_chef_dir(false) %>/first-boot.json <<'EOP'
|
232
232
|
<%= Chef::JSONCompat.to_json(first_boot) %>
|
233
233
|
EOP
|
234
234
|
|
@@ -120,11 +120,11 @@ If !ERRORLEVEL!==0 (
|
|
120
120
|
)
|
121
121
|
|
122
122
|
:install
|
123
|
-
@rem If user has provided the custom installation command
|
123
|
+
@rem If user has provided the custom installation command, execute it
|
124
124
|
<% if @chef_config[:knife][:bootstrap_install_command] %>
|
125
125
|
<%= @chef_config[:knife][:bootstrap_install_command] %>
|
126
126
|
<% else %>
|
127
|
-
@rem Install Chef using
|
127
|
+
@rem Install Chef using the MSI installer
|
128
128
|
|
129
129
|
@set "LOCAL_DESTINATION_MSI_PATH=<%= local_download_path %>"
|
130
130
|
@set "CHEF_CLIENT_MSI_LOG_PATH=%TEMP%\<%= Chef::Dist::CLIENT %>-msi%RANDOM%.log"
|
data/lib/chef/knife/core/ui.rb
CHANGED
@@ -208,7 +208,7 @@ class Chef
|
|
208
208
|
tf.sync = true
|
209
209
|
tf.puts output
|
210
210
|
tf.close
|
211
|
-
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup
|
211
|
+
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup/ for details." unless system("#{config[:editor]} #{tf.path}")
|
212
212
|
|
213
213
|
output = IO.read(tf.path)
|
214
214
|
end
|
@@ -59,9 +59,9 @@ class Chef
|
|
59
59
|
client_rb = <<~CONFIG
|
60
60
|
chef_server_url "#{@chef_config[:chef_server_url]}"
|
61
61
|
validation_client_name "#{@chef_config[:validation_client_name]}"
|
62
|
-
file_cache_path "
|
63
|
-
file_backup_path "
|
64
|
-
cache_options ({:path => "
|
62
|
+
file_cache_path "#{ChefConfig::Config.var_chef_dir(true)}/cache"
|
63
|
+
file_backup_path "#{ChefConfig::Config.var_chef_dir(true)}/backup"
|
64
|
+
cache_options ({:path => "#{ChefConfig::Config.etc_chef_dir(true)}/cache/checksums", :skip_expires => true})
|
65
65
|
CONFIG
|
66
66
|
|
67
67
|
unless @chef_config[:chef_license].nil?
|
@@ -124,11 +124,11 @@ class Chef
|
|
124
124
|
end
|
125
125
|
|
126
126
|
if @config[:secret]
|
127
|
-
client_rb << %Q{encrypted_data_bag_secret "
|
127
|
+
client_rb << %Q{encrypted_data_bag_secret "#{ChefConfig::Config.etc_chef_dir(true)}/encrypted_data_bag_secret"\n}
|
128
128
|
end
|
129
129
|
|
130
130
|
unless trusted_certs_script.empty?
|
131
|
-
client_rb << %Q{trusted_certs_dir "
|
131
|
+
client_rb << %Q{trusted_certs_dir "#{ChefConfig::Config.etc_chef_dir(true)}/trusted_certs"\n}
|
132
132
|
end
|
133
133
|
|
134
134
|
if Chef::Config[:fips]
|
@@ -158,8 +158,8 @@ class Chef
|
|
158
158
|
|
159
159
|
def start_chef
|
160
160
|
bootstrap_environment_option = bootstrap_environment.nil? ? "" : " -E #{bootstrap_environment}"
|
161
|
-
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin
|
162
|
-
start_chef << "chef-client -c
|
161
|
+
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\embedded\\bin\;%PATH%\"\n"
|
162
|
+
start_chef << "chef-client -c #{ChefConfig::Config.etc_chef_dir(true)}/client.rb -j #{ChefConfig::Config.etc_chef_dir(true)}/first-boot.json#{bootstrap_environment_option}\n"
|
163
163
|
end
|
164
164
|
|
165
165
|
def win_wget
|
@@ -260,7 +260,7 @@ class Chef
|
|
260
260
|
end
|
261
261
|
|
262
262
|
def bootstrap_directory
|
263
|
-
|
263
|
+
ChefConfig::Config.etc_chef_dir(true)
|
264
264
|
end
|
265
265
|
|
266
266
|
def local_download_path
|
@@ -37,13 +37,13 @@ class Chef
|
|
37
37
|
item = Chef::DataBagItem.load(bag, item_name)
|
38
38
|
if encrypted?(item.raw_data)
|
39
39
|
if encryption_secret_provided_ignore_encrypt_flag?
|
40
|
-
|
40
|
+
[Chef::EncryptedDataBagItem.new(item, read_secret).to_hash, true]
|
41
41
|
else
|
42
42
|
ui.fatal("You cannot edit an encrypted data bag without providing the secret.")
|
43
43
|
exit(1)
|
44
44
|
end
|
45
45
|
else
|
46
|
-
|
46
|
+
[item.raw_data, false]
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
data/lib/chef/knife/edit.rb
CHANGED
@@ -74,7 +74,7 @@ class Chef
|
|
74
74
|
|
75
75
|
# Let the user edit the temporary file
|
76
76
|
unless system("#{config[:editor]} #{file.path}")
|
77
|
-
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup
|
77
|
+
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup/ for details."
|
78
78
|
end
|
79
79
|
|
80
80
|
result_text = IO.read(file.path)
|
@@ -81,7 +81,7 @@ class Chef
|
|
81
81
|
|
82
82
|
def constraint_list(environments)
|
83
83
|
constraints = {}
|
84
|
-
environments.each do |env, url| # rubocop:disable
|
84
|
+
environments.each do |env, url| # rubocop:disable Style/HashEachMethods
|
85
85
|
# Because you cannot modify the default environment I filter it out here.
|
86
86
|
unless env == "_default"
|
87
87
|
envdata = Chef::Environment.load(env)
|
data/lib/chef/knife/list.rb
CHANGED
@@ -90,7 +90,7 @@ class Chef
|
|
90
90
|
|
91
91
|
# Flatten out directory results if necessary
|
92
92
|
if config[:flat]
|
93
|
-
dir_results.each do |result, children| # rubocop:disable
|
93
|
+
dir_results.each do |result, children| # rubocop:disable Style/HashEachMethods
|
94
94
|
results += children
|
95
95
|
end
|
96
96
|
dir_results = []
|
@@ -55,7 +55,7 @@ class Chef
|
|
55
55
|
The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
|
56
56
|
User keys are now managed via the key rotation commmands.
|
57
57
|
Please refer to the documentation on how to manage your keys via the key rotation commands:
|
58
|
-
https://docs.chef.io/
|
58
|
+
https://docs.chef.io/ctl_chef_server/#key-rotation
|
59
59
|
EOH
|
60
60
|
end
|
61
61
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: AJ Christensen (<aj@chef.io>)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-2020, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -76,10 +76,7 @@ class Chef
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def append_flags
|
79
|
-
|
80
|
-
when "openbsd", "netbsd", "aix", "smartos", "omnios"
|
81
|
-
"-G"
|
82
|
-
end
|
79
|
+
"-G" if platform?("openbsd", "netbsd", "aix", "smartos", "omnios")
|
83
80
|
end
|
84
81
|
|
85
82
|
end
|