chef 16.1.0-universal-mingw32 → 16.1.16-universal-mingw32
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/Rakefile +15 -1
- data/distro/powershell/chef/chef.psm1 +3 -3
- data/distro/templates/powershell/chef/chef.psm1.erb +3 -3
- data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +3 -3
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook_loader.rb +1 -1
- data/lib/chef/cookbook_manifest.rb +1 -1
- data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +2 -2
- data/lib/chef/data_collector.rb +1 -1
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/decorator/lazy_array.rb +2 -2
- data/lib/chef/digester.rb +4 -4
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -1
- data/lib/chef/formatters/base.rb +1 -1
- data/lib/chef/http.rb +1 -1
- data/lib/chef/http/decompressor.rb +1 -1
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/key.rb +1 -1
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +5 -5
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -1
- data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
- data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +3 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +1 -1
- data/lib/chef/knife/core/node_presenter.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/core/windows_bootstrap_context.rb +18 -3
- data/lib/chef/knife/key_create_base.rb +1 -1
- data/lib/chef/knife/key_edit_base.rb +1 -1
- data/lib/chef/knife/ssh.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +1 -1
- data/lib/chef/mixin/checksum.rb +0 -1
- data/lib/chef/mixin/openssl_helper.rb +4 -4
- data/lib/chef/mixin/properties.rb +2 -2
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/node/attribute.rb +2 -2
- data/lib/chef/node/immutable_collections.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/property.rb +2 -2
- data/lib/chef/provider.rb +3 -3
- data/lib/chef/provider/directory.rb +1 -1
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +1 -1
- data/lib/chef/provider/package/portage.rb +1 -0
- data/lib/chef/provider/package/rubygems.rb +1 -1
- data/lib/chef/provider/package/windows.rb +2 -2
- data/lib/chef/provider/package/yum.rb +1 -1
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/remote_directory.rb +2 -2
- data/lib/chef/provider/service/arch.rb +1 -1
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/user/aix.rb +1 -1
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/mac.rb +10 -6
- data/lib/chef/provider/windows_task.rb +4 -2
- data/lib/chef/resource.rb +3 -3
- data/lib/chef/resource/chef_handler.rb +2 -2
- data/lib/chef/resource/chef_vault_secret.rb +1 -1
- 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/file.rb +10 -8
- data/lib/chef/resource/hostname.rb +1 -1
- data/lib/chef/resource/locale.rb +3 -3
- data/lib/chef/resource/macos_userdefaults.rb +11 -6
- data/lib/chef/resource/scm/git.rb +1 -1
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_dfs_server.rb +1 -1
- data/lib/chef/resource/windows_pagefile.rb +1 -1
- data/lib/chef/resource/windows_task.rb +6 -6
- data/lib/chef/resource/windows_user_privilege.rb +3 -3
- data/lib/chef/resource_inspector.rb +4 -3
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/shell/ext.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +2 -2
- data/lib/chef/win32/api/error.rb +3 -1
- data/lib/chef/win32/api/file.rb +1 -1
- data/lib/chef/win32/api/net.rb +1 -0
- data/lib/chef/win32/mutex.rb +1 -1
- data/lib/chef/win32/net.rb +1 -0
- data/lib/chef/win32/security/sid.rb +4 -4
- data/spec/functional/resource/dnf_package_spec.rb +2 -2
- data/spec/functional/resource/git_spec.rb +6 -6
- data/spec/functional/resource/windows_task_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +4 -4
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +7 -1
- data/spec/unit/mixin/openssl_helper_spec.rb +4 -4
- data/spec/unit/node/attribute_spec.rb +1 -1
- data/spec/unit/provider/group/groupadd_spec.rb +1 -1
- data/spec/unit/provider/package/portage_spec.rb +2 -2
- data/spec/unit/provider/package/powershell_spec.rb +1 -1
- data/spec/unit/win32/registry_spec.rb +1 -1
- metadata +6 -6
@@ -95,7 +95,7 @@ class Chef
|
|
95
95
|
summarized = ""
|
96
96
|
list.each do |data|
|
97
97
|
node = data
|
98
|
-
# special case clouds with their split horizon
|
98
|
+
# special case clouds with their split horizon thing.
|
99
99
|
ip = (node[:cloud] && node[:cloud][:public_ipv4_addrs] && node[:cloud][:public_ipv4_addrs].first) || node[:ipaddress]
|
100
100
|
fqdn = (node[:cloud] && node[:cloud][:public_hostname]) || node[:fqdn]
|
101
101
|
name = node["name"] || node.name
|
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
# optionally filtering by category
|
33
33
|
# subcommand_files - returns an array of all subcommand files
|
34
34
|
# that could be loaded
|
35
|
-
#
|
35
|
+
# command_class_from(args) - returns the subcommand class for the
|
36
36
|
# user-requested command
|
37
37
|
#
|
38
38
|
class SubcommandLoader
|
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
class Knife
|
25
25
|
module Core
|
26
26
|
# Instances of BootstrapContext are the context objects (i.e., +self+) for
|
27
|
-
# bootstrap templates. For backwards
|
27
|
+
# bootstrap templates. For backwards compatibility, they +must+ set the
|
28
28
|
# following instance variables:
|
29
29
|
# * @config - a hash of knife's config values
|
30
30
|
# * @run_list - the run list for the node to boostrap
|
@@ -41,6 +41,21 @@ class Chef
|
|
41
41
|
super(config, run_list, chef_config, secret)
|
42
42
|
end
|
43
43
|
|
44
|
+
# This is a duplicate of ChefConfig::PathHelper.cleanpath, however
|
45
|
+
# this presumes Windows so we can avoid changing the method definitions
|
46
|
+
# across Chef, ChefConfig, and ChefUtils for the circumstance where
|
47
|
+
# the methods are being run for a system other than the one Ruby is
|
48
|
+
# executing on.
|
49
|
+
#
|
50
|
+
# We only need to cleanpath the paths that we are passing to cmd.exe,
|
51
|
+
# anything written to a configuration file or passed as an argument
|
52
|
+
# will be interpreted by ruby later and do the right thing.
|
53
|
+
def cleanpath(path)
|
54
|
+
path = Pathname.new(path).cleanpath.to_s
|
55
|
+
path = path.gsub(File::SEPARATOR, '\\')
|
56
|
+
path
|
57
|
+
end
|
58
|
+
|
44
59
|
def validation_key
|
45
60
|
if File.exist?(File.expand_path(chef_config[:validation_key]))
|
46
61
|
IO.read(File.expand_path(chef_config[:validation_key]))
|
@@ -160,7 +175,7 @@ class Chef
|
|
160
175
|
|
161
176
|
def start_chef
|
162
177
|
bootstrap_environment_option = bootstrap_environment.nil? ? "" : " -E #{bootstrap_environment}"
|
163
|
-
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}
|
178
|
+
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\bin;#{ChefConfig::Config.c_opscode_dir}\\embedded\\bin\;%PATH%\"\n"
|
164
179
|
start_chef << "#{Chef::Dist::CLIENT} -c #{ChefConfig::Config.etc_chef_dir(true)}/client.rb -j #{ChefConfig::Config.etc_chef_dir(true)}/first-boot.json#{bootstrap_environment_option}\n"
|
165
180
|
end
|
166
181
|
|
@@ -262,7 +277,7 @@ class Chef
|
|
262
277
|
end
|
263
278
|
|
264
279
|
def bootstrap_directory
|
265
|
-
ChefConfig::Config.etc_chef_dir(true)
|
280
|
+
cleanpath(ChefConfig::Config.etc_chef_dir(true))
|
266
281
|
end
|
267
282
|
|
268
283
|
def local_download_path
|
@@ -42,7 +42,7 @@ class Chef
|
|
42
42
|
option :expiration_date,
|
43
43
|
short: "-e DATE",
|
44
44
|
long: "--expiration-date DATE",
|
45
|
-
description: "Optionally pass the expiration date for the key in ISO 8601
|
45
|
+
description: "Optionally pass the expiration date for the key in ISO 8601 formatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed."
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
option :expiration_date,
|
48
48
|
short: "-e DATE",
|
49
49
|
long: "--expiration-date DATE",
|
50
|
-
description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601
|
50
|
+
description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601 formatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed."
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/lib/chef/knife/ssh.rb
CHANGED
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
|
60
60
|
option :prefix_attribute,
|
61
61
|
long: "--prefix-attribute ATTR",
|
62
|
-
description: "The attribute to use for prefixing the
|
62
|
+
description: "The attribute to use for prefixing the output - default depends on the context."
|
63
63
|
|
64
64
|
option :ssh_user,
|
65
65
|
short: "-x USERNAME",
|
@@ -53,7 +53,7 @@ class Chef
|
|
53
53
|
<<~EOH
|
54
54
|
The reregister command only supports server API version 0.
|
55
55
|
The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
|
56
|
-
User keys are now managed via the key rotation
|
56
|
+
User keys are now managed via the key rotation commands.
|
57
57
|
Please refer to the documentation on how to manage your keys via the key rotation commands:
|
58
58
|
https://docs.chef.io/ctl_chef_server/#key-rotation
|
59
59
|
EOH
|
data/lib/chef/mixin/checksum.rb
CHANGED
@@ -218,7 +218,7 @@ class Chef
|
|
218
218
|
# Chef 12 backward compatibility
|
219
219
|
::OpenSSL::PKey::EC.send(:alias_method, :private?, :private_key?)
|
220
220
|
|
221
|
-
request.sign(key, ::OpenSSL::Digest
|
221
|
+
request.sign(key, ::OpenSSL::Digest.new("SHA256"))
|
222
222
|
request
|
223
223
|
end
|
224
224
|
|
@@ -289,7 +289,7 @@ class Chef
|
|
289
289
|
cert.add_extension ef.create_extension("authorityKeyIdentifier",
|
290
290
|
"keyid:always,issuer:always")
|
291
291
|
|
292
|
-
cert.sign(key, ::OpenSSL::Digest
|
292
|
+
cert.sign(key, ::OpenSSL::Digest.new("SHA256"))
|
293
293
|
cert
|
294
294
|
end
|
295
295
|
|
@@ -319,7 +319,7 @@ class Chef
|
|
319
319
|
crl.add_extension ::OpenSSL::X509::Extension.new("crlNumber", ::OpenSSL::ASN1::Integer(1))
|
320
320
|
crl.add_extension ef.create_extension("authorityKeyIdentifier",
|
321
321
|
"keyid:always,issuer:always")
|
322
|
-
crl.sign(ca_private_key, ::OpenSSL::Digest
|
322
|
+
crl.sign(ca_private_key, ::OpenSSL::Digest.new("SHA256"))
|
323
323
|
crl
|
324
324
|
end
|
325
325
|
|
@@ -398,7 +398,7 @@ class Chef
|
|
398
398
|
::OpenSSL::ASN1::Integer(get_next_crl_number(crl)))]
|
399
399
|
crl.add_extension ef.create_extension("authorityKeyIdentifier",
|
400
400
|
"keyid:always,issuer:always")
|
401
|
-
crl.sign(ca_private_key, ::OpenSSL::Digest
|
401
|
+
crl.sign(ca_private_key, ::OpenSSL::Digest.new("SHA256"))
|
402
402
|
crl
|
403
403
|
end
|
404
404
|
|
@@ -264,7 +264,7 @@ class Chef
|
|
264
264
|
end
|
265
265
|
|
266
266
|
result = properties.values.select(&:identity?)
|
267
|
-
# if there are no other identity
|
267
|
+
# if there are no other identity properties set, then the name_property becomes the identity, or
|
268
268
|
# failing that we use the actual name.
|
269
269
|
if result.empty?
|
270
270
|
result = name_property ? [ properties[name_property] ] : [ properties[:name] ]
|
@@ -355,7 +355,7 @@ class Chef
|
|
355
355
|
#
|
356
356
|
# @param other [Object] the other object (Chef::Resource) which implements the properties API
|
357
357
|
# @param includes [Array<Symbol>] splat-args list of symbols of the properties to copy.
|
358
|
-
# @param exclude [Array<Symbol>] list of
|
358
|
+
# @param exclude [Array<Symbol>] list of symbols of the properties to exclude.
|
359
359
|
# @return the self object the properties were copied to for method chaining
|
360
360
|
#
|
361
361
|
def copy_properties_from(other, *includes, exclude: [ :name ])
|
data/lib/chef/mixin/shell_out.rb
CHANGED
@@ -71,7 +71,7 @@ class Chef
|
|
71
71
|
default_val = 900
|
72
72
|
return options if options.key?(:timeout)
|
73
73
|
|
74
|
-
# FIXME: need to nuke
|
74
|
+
# FIXME: need to nuke descendent tracker out of Chef::Provider so we can just define that class here without requiring the
|
75
75
|
# world, and then just use symbol lookup
|
76
76
|
if obj.class.ancestors.map(&:name).include?("Chef::Provider") && obj.respond_to?(:new_resource) && obj.new_resource.respond_to?(:timeout) && !options.key?(:timeout)
|
77
77
|
options[:timeout] = obj.new_resource.timeout ? obj.new_resource.timeout.to_f : default_val
|
data/lib/chef/node/attribute.rb
CHANGED
@@ -184,7 +184,7 @@ class Chef
|
|
184
184
|
# return the role level override attribute component
|
185
185
|
attr_reader :role_override
|
186
186
|
|
187
|
-
# return the
|
187
|
+
# return the environment level override attribute component
|
188
188
|
attr_reader :env_override
|
189
189
|
|
190
190
|
# return the force override level attribute component
|
@@ -535,7 +535,7 @@ class Chef
|
|
535
535
|
e
|
536
536
|
end
|
537
537
|
|
538
|
-
# Deep merge all attribute levels using hash-only merging between different
|
538
|
+
# Deep merge all attribute levels using hash-only merging between different precedence
|
539
539
|
# levels (so override arrays completely replace arrays set at any default level).
|
540
540
|
#
|
541
541
|
# The path allows for selectively deep-merging a subtree of the node object.
|
@@ -120,7 +120,7 @@ class Chef
|
|
120
120
|
# ImmutableMash acts like a Mash (Hash that is indifferent to String or
|
121
121
|
# Symbol keys), with some important exceptions:
|
122
122
|
# * Methods that mutate state are overridden to raise an error instead.
|
123
|
-
# * Methods that read from the collection are
|
123
|
+
# * Methods that read from the collection are overridden so that they check
|
124
124
|
# if the Chef::Node::Attribute has been modified since an instance of
|
125
125
|
# this class was generated. An error is raised if the object detects that
|
126
126
|
# it is stale.
|
@@ -328,7 +328,7 @@ class Chef
|
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
331
|
-
# Do some
|
331
|
+
# Do some minimal validation of the policyfile we fetched from the
|
332
332
|
# server. Compatibility mode relies on using data bags to store policy
|
333
333
|
# files; therefore no real validation will be performed server-side and
|
334
334
|
# we need to make additional checks to ensure the data will be formatted
|
data/lib/chef/property.rb
CHANGED
@@ -574,7 +574,7 @@ class Chef
|
|
574
574
|
# be using the existing getter/setter to manipulate it instead.
|
575
575
|
return unless instance_variable_name
|
576
576
|
|
577
|
-
# Properties may override existing properties up the inheritance
|
577
|
+
# Properties may override existing properties up the inheritance hierarchy, but
|
578
578
|
# properties must not override inherited methods like Object#hash. When the Resource is
|
579
579
|
# placed into the resource collection the ruby Hash object will call the
|
580
580
|
# Object#hash method on the resource, and overriding that with a property will cause
|
@@ -702,7 +702,7 @@ class Chef
|
|
702
702
|
# override their own properties.
|
703
703
|
return false unless [ Object, BasicObject, Kernel, Chef::Resource ].include?(declared_in.instance_method(name).owner)
|
704
704
|
|
705
|
-
# Allow top-level Chef::Resource
|
705
|
+
# Allow top-level Chef::Resource properties, such as `name`, to be overridden.
|
706
706
|
# As of this writing, `name` is the only Chef::Resource property created with the
|
707
707
|
# `property` definition, but this will allow for future properties to be extended
|
708
708
|
# as needed.
|
data/lib/chef/provider.rb
CHANGED
@@ -152,7 +152,7 @@ class Chef
|
|
152
152
|
new_resource.cookbook_name
|
153
153
|
end
|
154
154
|
|
155
|
-
# hook that subclasses can use to do lazy validation for where properties aren't
|
155
|
+
# hook that subclasses can use to do lazy validation for where properties aren't flexible enough
|
156
156
|
def check_resource_semantics!; end
|
157
157
|
|
158
158
|
# a simple placeholder method that will be called / raise if a resource tries to
|
@@ -167,7 +167,7 @@ class Chef
|
|
167
167
|
|
168
168
|
def load_after_resource
|
169
169
|
# This is a backwards compatible hack, custom resources properly wire up a new after_resource
|
170
|
-
# via load_current_value. It is
|
170
|
+
# via load_current_value. It is acceptable for old style resources that cannot be easily made
|
171
171
|
# into custom resources to override this method and provide a proper after_resource.
|
172
172
|
@after_resource = @new_resource
|
173
173
|
end
|
@@ -190,7 +190,7 @@ class Chef
|
|
190
190
|
def run_action(action = nil)
|
191
191
|
@action = action unless action.nil?
|
192
192
|
|
193
|
-
# hook that subclasses can use to do lazy validation for where properties aren't
|
193
|
+
# hook that subclasses can use to do lazy validation for where properties aren't flexible enough
|
194
194
|
check_resource_semantics!
|
195
195
|
|
196
196
|
# force the validation of required properties
|
@@ -142,7 +142,7 @@ class Chef
|
|
142
142
|
converge_by("delete existing directory #{new_resource.path}") do
|
143
143
|
if new_resource.recursive == true
|
144
144
|
# we don't use rm_rf here because it masks all errors, including
|
145
|
-
# IO errors or permission errors that would
|
145
|
+
# IO errors or permission errors that would prevent the deletion
|
146
146
|
FileUtils.rm_r(new_resource.path)
|
147
147
|
logger.info("#{new_resource} deleted #{new_resource.path} recursively")
|
148
148
|
else
|
data/lib/chef/provider/file.rb
CHANGED
@@ -334,7 +334,7 @@ class Chef
|
|
334
334
|
end
|
335
335
|
|
336
336
|
def do_validate_content
|
337
|
-
if new_resource.checksum && tempfile && ( new_resource.checksum
|
337
|
+
if new_resource.checksum && tempfile && ( new_resource.checksum != tempfile_checksum )
|
338
338
|
raise Chef::Exceptions::ChecksumMismatch.new(short_cksum(new_resource.checksum), short_cksum(tempfile_checksum))
|
339
339
|
end
|
340
340
|
|
@@ -249,7 +249,7 @@ class Chef
|
|
249
249
|
end
|
250
250
|
|
251
251
|
# Helper to convert choco.exe list output to a Hash
|
252
|
-
# (names are downcased for case-
|
252
|
+
# (names are downcased for case-insensitive matching)
|
253
253
|
#
|
254
254
|
# @param cmd [String] command to run
|
255
255
|
# @return [Hash] list output converted to ruby Hash
|
@@ -149,7 +149,7 @@ class Chef
|
|
149
149
|
resolved_source_array.all? { |s| s && ::File.exist?(s) }
|
150
150
|
end
|
151
151
|
|
152
|
-
# Helper to return all the
|
152
|
+
# Helper to return all the names of the missing sources for error messages.
|
153
153
|
#
|
154
154
|
# @return [Array<String>] Array of missing sources
|
155
155
|
def missing_sources
|
@@ -70,6 +70,7 @@ class Chef
|
|
70
70
|
|
71
71
|
if pkginfo.exitstatus != 0
|
72
72
|
pkginfo.stderr.each_line do |line|
|
73
|
+
# cspell:disable-next-line
|
73
74
|
if line =~ /[Uu]nqualified atom .*match.* multiple/
|
74
75
|
raise_error_for_query("matched multiple packages (please specify a category):\n#{pkginfo.inspect}")
|
75
76
|
end
|
@@ -38,7 +38,7 @@ class Chef
|
|
38
38
|
def define_resource_requirements
|
39
39
|
if new_resource.checksum
|
40
40
|
requirements.assert(:install) do |a|
|
41
|
-
a.assertion { new_resource.checksum
|
41
|
+
a.assertion { new_resource.checksum == checksum(source_location) }
|
42
42
|
a.failure_message Chef::Exceptions::Package, "Checksum on resource (#{short_cksum(new_resource.checksum)}) does not match checksum on content (#{short_cksum(source_location)})"
|
43
43
|
end
|
44
44
|
end
|
@@ -169,7 +169,7 @@ class Chef
|
|
169
169
|
# is not multipackage. The existing implementation of package_provider.installed_version should probably
|
170
170
|
# be what `uninstall_version_array` is, and then that list should be sorted and last/first'd into the
|
171
171
|
# current_resource.version. The current_version_array method was not intended to be overwritten by
|
172
|
-
#
|
172
|
+
# subclasses (but ruby provides no feature to block doing so -- it is already marked as private).
|
173
173
|
#
|
174
174
|
def current_version_array
|
175
175
|
[ current_resource.version ]
|
@@ -100,7 +100,7 @@ class Chef
|
|
100
100
|
|
101
101
|
# If this is a package like the kernel that can be installed multiple times, we'll skip over this logic
|
102
102
|
if new_resource.allow_downgrade && version_gt?(iv.version_with_arch, av.version_with_arch) && !python_helper.install_only_packages(name)
|
103
|
-
# We allow downgrading only in the
|
103
|
+
# We allow downgrading only in the event of single-package
|
104
104
|
# rules where the user explicitly allowed it
|
105
105
|
method = "downgrade"
|
106
106
|
end
|
@@ -22,7 +22,7 @@ require "singleton" unless defined?(Singleton)
|
|
22
22
|
|
23
23
|
#
|
24
24
|
# These are largely historical APIs, the YumCache object no longer exists and this is a
|
25
|
-
#
|
25
|
+
# facade over the python helper class. It should be considered deprecated-lite and
|
26
26
|
# no new APIs should be added and should be added to the python_helper instead.
|
27
27
|
#
|
28
28
|
|
@@ -147,7 +147,7 @@ class Chef
|
|
147
147
|
new_resource.updated_by_last_action(true) if res.updated?
|
148
148
|
end
|
149
149
|
|
150
|
-
# Get the files to
|
150
|
+
# Get the files to transfer. This returns files in lexicographical sort order.
|
151
151
|
#
|
152
152
|
# FIXME: it should do breadth-first, see CHEF-5080 (please use a performant sort)
|
153
153
|
#
|
@@ -245,7 +245,7 @@ class Chef
|
|
245
245
|
res = Chef::Resource::Directory.new(dir, run_context)
|
246
246
|
res.cookbook_name = resource_cookbook
|
247
247
|
if ChefUtils.windows? && rights
|
248
|
-
# rights are only meant to be applied to the
|
248
|
+
# rights are only meant to be applied to the most top-level directory;
|
249
249
|
# Windows will handle inheritance.
|
250
250
|
if dir == path
|
251
251
|
rights.each do |r|
|
@@ -42,7 +42,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# Get list of all daemons from the file '/etc/rc.conf'.
|
45
|
-
#
|
45
|
+
# Multiple lines and background form are supported. Example:
|
46
46
|
# DAEMONS=(\
|
47
47
|
# foobar \
|
48
48
|
# @example \
|
@@ -41,7 +41,7 @@ class Chef
|
|
41
41
|
|
42
42
|
# Upstart does more than start or stop a service, creating multiple 'states' [1] that a service can be in.
|
43
43
|
# In chef, when we ask a service to start, we expect it to have started before performing the next step
|
44
|
-
# since we have top down dependencies. Which is to say we may follow
|
44
|
+
# since we have top down dependencies. Which is to say we may follow with a resource next that requires
|
45
45
|
# that service to be running. According to [2] we can trust that sending a 'goal' such as start will not
|
46
46
|
# return until that 'goal' is reached, or some error has occurred.
|
47
47
|
#
|
@@ -40,7 +40,7 @@ class Chef
|
|
40
40
|
shell_out!("userdel", userdel_options, new_resource.username)
|
41
41
|
end
|
42
42
|
|
43
|
-
# Aix does not support -r like other unix,
|
43
|
+
# Aix does not support -r like other unix, system account is created by adding to 'system' group
|
44
44
|
def useradd_options
|
45
45
|
opts = []
|
46
46
|
opts << "-g" << "system" if new_resource.system
|
@@ -382,7 +382,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
|
|
382
382
|
salt,
|
383
383
|
iterations,
|
384
384
|
128,
|
385
|
-
OpenSSL::Digest
|
385
|
+
OpenSSL::Digest.new("SHA512")
|
386
386
|
)
|
387
387
|
end
|
388
388
|
|
@@ -627,7 +627,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
|
|
627
627
|
salt,
|
628
628
|
current_resource.iterations,
|
629
629
|
128,
|
630
|
-
OpenSSL::Digest
|
630
|
+
OpenSSL::Digest.new("SHA512")
|
631
631
|
).unpack("H*").first == current_resource.password
|
632
632
|
end
|
633
633
|
|
@@ -102,7 +102,7 @@ class Chef
|
|
102
102
|
shadow_hash_hex = user_plist[:shadow_hash][0]
|
103
103
|
return unless shadow_hash_hex && shadow_hash_hex != ""
|
104
104
|
|
105
|
-
# The password
|
105
|
+
# The password information is stored in the ShadowHashData key in the
|
106
106
|
# plist. However, parsing it is a bit tricky as the value is itself
|
107
107
|
# another encoded binary plist. We have to extract the encoded plist,
|
108
108
|
# decode it from hex to a binary plist and then convert the binary
|
@@ -116,6 +116,8 @@ class Chef
|
|
116
116
|
#
|
117
117
|
# eg:
|
118
118
|
#
|
119
|
+
# spellchecker: disable
|
120
|
+
#
|
119
121
|
# <array>
|
120
122
|
# <string>77687920 63616e27 74206170 706c6520 6275696c 6420636f 6e736973 74656e74 20746f6f 6c696e67</string>
|
121
123
|
# </array>
|
@@ -126,6 +128,8 @@ class Chef
|
|
126
128
|
# <data>AADKAAAKAA4LAA0MAAAAAAAAAAA=</data>
|
127
129
|
# </array>
|
128
130
|
#
|
131
|
+
# spellchecker: disable
|
132
|
+
#
|
129
133
|
begin
|
130
134
|
shadow_binary_plist = [shadow_hash_hex.delete(" ")].pack("H*")
|
131
135
|
shadow_xml_plist = shell_out("plutil", "-convert", "xml1", "-o", "-", "-", input: shadow_binary_plist).stdout
|
@@ -179,7 +183,7 @@ class Chef
|
|
179
183
|
end
|
180
184
|
|
181
185
|
if new_resource.manage_home
|
182
|
-
# "
|
186
|
+
# "sysadminctl -addUser" will create the home directory if it's
|
183
187
|
# the default /Users/<username>, otherwise it sets it in plist
|
184
188
|
# but does not create it. Here we'll ensure that it gets created
|
185
189
|
# if we've been given a directory that is not the default.
|
@@ -491,7 +495,7 @@ class Chef
|
|
491
495
|
convert_to_binary(current_resource.salt),
|
492
496
|
current_resource.iterations.to_i,
|
493
497
|
128,
|
494
|
-
OpenSSL::Digest
|
498
|
+
OpenSSL::Digest.new("SHA512")
|
495
499
|
).unpack("H*")[0] != current_resource.password
|
496
500
|
end
|
497
501
|
|
@@ -517,7 +521,7 @@ class Chef
|
|
517
521
|
salt.string,
|
518
522
|
new_resource.iterations,
|
519
523
|
128,
|
520
|
-
OpenSSL::Digest
|
524
|
+
OpenSSL::Digest.new("SHA512")
|
521
525
|
)
|
522
526
|
)
|
523
527
|
end
|
@@ -554,7 +558,7 @@ class Chef
|
|
554
558
|
# 0x0A End of record denoted by \n
|
555
559
|
# 0x5C Escaping is denoted by \
|
556
560
|
# 0x3A Fields are separated by :
|
557
|
-
# 0x2C Values are
|
561
|
+
# 0x2C Values are separated by ,
|
558
562
|
# dsRecTypeStandard:Users The record type we're configuring
|
559
563
|
# 2 How many properties we're going to set
|
560
564
|
# dsAttrTypeStandard:RecordName Property 1: our users record name
|
@@ -598,7 +602,7 @@ class Chef
|
|
598
602
|
|
599
603
|
def run_sysadminctl(args)
|
600
604
|
# sysadminctl doesn't exit with a non-zero code when errors are encountered
|
601
|
-
# and
|
605
|
+
# and outputs everything to STDERR instead of STDOUT and STDERR. Therefore we'll
|
602
606
|
# return the STDERR and let the caller handle it.
|
603
607
|
shell_out!("sysadminctl", args).stderr
|
604
608
|
end
|