chef 12.18.31-universal-mingw32 → 12.19.33-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/Gemfile +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -37,7 +37,7 @@ class Chef
|
|
37
37
|
lead = 0
|
38
38
|
tail = evr.size
|
39
39
|
|
40
|
-
if
|
40
|
+
if /^([\d]+):/.match(evr) # rubocop:disable Performance/RedundantMatch
|
41
41
|
epoch = $1.to_i
|
42
42
|
lead = $1.length + 1
|
43
43
|
elsif evr[0].ord == ":".ord
|
@@ -45,7 +45,7 @@ class Chef
|
|
45
45
|
lead = 1
|
46
46
|
end
|
47
47
|
|
48
|
-
if
|
48
|
+
if /:?.*-(.*)$/.match(evr) # rubocop:disable Performance/RedundantMatch
|
49
49
|
release = $1
|
50
50
|
tail = evr.length - release.length - lead - 1
|
51
51
|
|
@@ -230,17 +230,17 @@ class Chef
|
|
230
230
|
@v = args[1]
|
231
231
|
@r = args[2]
|
232
232
|
else
|
233
|
-
raise ArgumentError, "Expecting either 'epoch-version-release' or 'epoch, "
|
233
|
+
raise ArgumentError, "Expecting either 'epoch-version-release' or 'epoch, " \
|
234
234
|
"version, release'"
|
235
235
|
end
|
236
236
|
end
|
237
237
|
attr_reader :e, :v, :r
|
238
|
-
alias
|
239
|
-
alias
|
240
|
-
alias
|
238
|
+
alias epoch e
|
239
|
+
alias version v
|
240
|
+
alias release r
|
241
241
|
|
242
242
|
def self.parse(*args)
|
243
|
-
|
243
|
+
new(*args)
|
244
244
|
end
|
245
245
|
|
246
246
|
def <=>(other)
|
@@ -317,7 +317,7 @@ class Chef
|
|
317
317
|
return cmp
|
318
318
|
end
|
319
319
|
|
320
|
-
|
320
|
+
0
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
@@ -339,7 +339,7 @@ class Chef
|
|
339
339
|
@a = args[4]
|
340
340
|
@provides = args[5]
|
341
341
|
else
|
342
|
-
raise ArgumentError, "Expecting either 'name, epoch-version-release, arch, provides' "
|
342
|
+
raise ArgumentError, "Expecting either 'name, epoch-version-release, arch, provides' " \
|
343
343
|
"or 'name, epoch, version, release, arch, provides'"
|
344
344
|
end
|
345
345
|
|
@@ -349,8 +349,8 @@ class Chef
|
|
349
349
|
end
|
350
350
|
end
|
351
351
|
attr_reader :n, :a, :version, :provides
|
352
|
-
alias
|
353
|
-
alias
|
352
|
+
alias name n
|
353
|
+
alias arch a
|
354
354
|
|
355
355
|
def <=>(other)
|
356
356
|
compare(other)
|
@@ -395,7 +395,7 @@ class Chef
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
|
-
|
398
|
+
0
|
399
399
|
end
|
400
400
|
|
401
401
|
def to_s
|
@@ -423,7 +423,7 @@ class Chef
|
|
423
423
|
@version = RPMVersion.new(e, v, r)
|
424
424
|
@flag = args[4] || :==
|
425
425
|
else
|
426
|
-
raise ArgumentError, "Expecting either 'name, epoch-version-release, flag' or "
|
426
|
+
raise ArgumentError, "Expecting either 'name, epoch-version-release, flag' or " \
|
427
427
|
"'name, epoch, version, release, flag'"
|
428
428
|
end
|
429
429
|
end
|
@@ -434,25 +434,25 @@ class Chef
|
|
434
434
|
# "mtr >= 2:0.71-3.0"
|
435
435
|
# "mta"
|
436
436
|
def self.parse(string)
|
437
|
-
if
|
437
|
+
if /^(\S+)\s+(>|>=|=|==|<=|<)\s+(\S+)$/.match(string) # rubocop:disable Performance/RedundantMatch
|
438
438
|
name = $1
|
439
|
-
if $2 == "="
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
439
|
+
flag = if $2 == "="
|
440
|
+
:==
|
441
|
+
else
|
442
|
+
:"#{$2}"
|
443
|
+
end
|
444
444
|
version = $3
|
445
445
|
|
446
|
-
|
446
|
+
new(name, version, flag)
|
447
447
|
else
|
448
448
|
name = string
|
449
|
-
|
449
|
+
new(name, nil, nil)
|
450
450
|
end
|
451
451
|
end
|
452
452
|
|
453
453
|
# Test if another RPMDependency satisfies our requirements
|
454
454
|
def satisfy?(y)
|
455
|
-
unless y.
|
455
|
+
unless y.is_a?(RPMDependency)
|
456
456
|
raise ArgumentError, "Expecting an RPMDependency object"
|
457
457
|
end
|
458
458
|
|
@@ -481,7 +481,7 @@ class Chef
|
|
481
481
|
return true
|
482
482
|
end
|
483
483
|
|
484
|
-
|
484
|
+
false
|
485
485
|
end
|
486
486
|
end
|
487
487
|
|
@@ -504,11 +504,11 @@ class Chef
|
|
504
504
|
class RPMDb
|
505
505
|
def initialize
|
506
506
|
# package name => [ RPMPackage, RPMPackage ] of different versions
|
507
|
-
@rpms =
|
507
|
+
@rpms = {}
|
508
508
|
# package nevra => RPMPackage for lookups
|
509
|
-
@index =
|
509
|
+
@index = {}
|
510
510
|
# provide name (aka feature) => [RPMPackage, RPMPackage] each providing this feature
|
511
|
-
@provides =
|
511
|
+
@provides = {}
|
512
512
|
# RPMPackages listed as available
|
513
513
|
@available = Set.new
|
514
514
|
# RPMPackages listed as installed
|
@@ -516,7 +516,7 @@ class Chef
|
|
516
516
|
end
|
517
517
|
|
518
518
|
def [](package_name)
|
519
|
-
|
519
|
+
lookup(package_name)
|
520
520
|
end
|
521
521
|
|
522
522
|
# Lookup package_name and return a descending array of package objects
|
@@ -537,11 +537,11 @@ class Chef
|
|
537
537
|
# The available/installed state can be overwritten for existing packages.
|
538
538
|
def push(*args)
|
539
539
|
args.flatten.each do |new_rpm|
|
540
|
-
unless new_rpm.
|
540
|
+
unless new_rpm.is_a?(RPMDbPackage)
|
541
541
|
raise ArgumentError, "Expecting an RPMDbPackage object"
|
542
542
|
end
|
543
543
|
|
544
|
-
@rpms[new_rpm.n] ||=
|
544
|
+
@rpms[new_rpm.n] ||= []
|
545
545
|
|
546
546
|
# we may already have this one, like when the installed list is refreshed
|
547
547
|
idx = @index[new_rpm.nevra]
|
@@ -552,7 +552,7 @@ class Chef
|
|
552
552
|
@rpms[new_rpm.n] << new_rpm
|
553
553
|
|
554
554
|
new_rpm.provides.each do |provide|
|
555
|
-
@provides[provide.name] ||=
|
555
|
+
@provides[provide.name] ||= []
|
556
556
|
@provides[provide.name] << new_rpm
|
557
557
|
end
|
558
558
|
|
@@ -574,7 +574,7 @@ class Chef
|
|
574
574
|
end
|
575
575
|
|
576
576
|
def <<(*args)
|
577
|
-
|
577
|
+
push(args)
|
578
578
|
end
|
579
579
|
|
580
580
|
def clear
|
@@ -596,7 +596,7 @@ class Chef
|
|
596
596
|
def size
|
597
597
|
@rpms.size
|
598
598
|
end
|
599
|
-
alias
|
599
|
+
alias length size
|
600
600
|
|
601
601
|
def available_size
|
602
602
|
@available.size
|
@@ -615,7 +615,7 @@ class Chef
|
|
615
615
|
end
|
616
616
|
|
617
617
|
def whatprovides(rpmdep)
|
618
|
-
unless rpmdep.
|
618
|
+
unless rpmdep.is_a?(RPMDependency)
|
619
619
|
raise ArgumentError, "Expecting an RPMDependency object"
|
620
620
|
end
|
621
621
|
|
@@ -632,7 +632,7 @@ class Chef
|
|
632
632
|
end
|
633
633
|
end
|
634
634
|
|
635
|
-
|
635
|
+
what
|
636
636
|
end
|
637
637
|
end
|
638
638
|
|
@@ -101,12 +101,12 @@ class Chef
|
|
101
101
|
status = nil
|
102
102
|
|
103
103
|
begin
|
104
|
-
status = shell_out!("#{python_bin} #{yum_dump_path}#{opts}", :
|
104
|
+
status = shell_out!("#{python_bin} #{yum_dump_path}#{opts}", timeout: Chef::Config[:yum_timeout])
|
105
105
|
status.stdout.each_line do |line|
|
106
106
|
one_line = true
|
107
107
|
|
108
108
|
line.chomp!
|
109
|
-
if line =~
|
109
|
+
if line =~ /\[option (.*)\] (.*)/
|
110
110
|
if $1 == "installonlypkgs"
|
111
111
|
@allow_multi_install = $2.split
|
112
112
|
else
|
@@ -115,7 +115,7 @@ class Chef
|
|
115
115
|
next
|
116
116
|
end
|
117
117
|
|
118
|
-
if line =~
|
118
|
+
if line =~ /^(\S+) ([0-9]+) (\S+) (\S+) (\S+) \[(.*)\] ([i,a,r]) (\S+)$/
|
119
119
|
name = $1
|
120
120
|
epoch = $2
|
121
121
|
version = $3
|
@@ -125,7 +125,7 @@ class Chef
|
|
125
125
|
type = $7
|
126
126
|
repoid = $8
|
127
127
|
else
|
128
|
-
Chef::Log.warn("Problem parsing line '#{line}' from yum-dump.py! "
|
128
|
+
Chef::Log.warn("Problem parsing line '#{line}' from yum-dump.py! " \
|
129
129
|
"Please check your yum configuration.")
|
130
130
|
next
|
131
131
|
end
|
@@ -158,7 +158,7 @@ class Chef
|
|
158
158
|
raise Chef::Exceptions::Package, "Yum failed - #{status.inspect} - returns: #{error}"
|
159
159
|
else
|
160
160
|
unless one_line
|
161
|
-
Chef::Log.warn("Odd, no output from yum-dump.py. Please check "
|
161
|
+
Chef::Log.warn("Odd, no output from yum-dump.py. Please check " \
|
162
162
|
"your yum configuration.")
|
163
163
|
end
|
164
164
|
end
|
@@ -233,7 +233,7 @@ class Chef
|
|
233
233
|
if @rpmdb.lookup(package_name)
|
234
234
|
return true
|
235
235
|
else
|
236
|
-
if package_name =~
|
236
|
+
if package_name =~ /^(.*)\.(.*)$/
|
237
237
|
pkg_name = $1
|
238
238
|
pkg_arch = $2
|
239
239
|
|
@@ -245,7 +245,7 @@ class Chef
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
|
-
|
248
|
+
false
|
249
249
|
end
|
250
250
|
|
251
251
|
# Returns a array of packages satisfying an RPMDependency
|
@@ -260,7 +260,7 @@ class Chef
|
|
260
260
|
return true if desired_version == v
|
261
261
|
end
|
262
262
|
|
263
|
-
|
263
|
+
false
|
264
264
|
end
|
265
265
|
|
266
266
|
# Return the source repository for a package-version.arch
|
@@ -269,14 +269,14 @@ class Chef
|
|
269
269
|
return pkg.repoid if desired_version == pkg.version.to_s
|
270
270
|
end
|
271
271
|
|
272
|
-
|
272
|
+
nil
|
273
273
|
end
|
274
274
|
|
275
275
|
# Return the latest available version for a package.arch
|
276
276
|
def available_version(package_name, arch = nil)
|
277
277
|
version(package_name, arch, true, false)
|
278
278
|
end
|
279
|
-
alias
|
279
|
+
alias candidate_version available_version
|
280
280
|
|
281
281
|
# Return the currently installed version for a package.arch
|
282
282
|
def installed_version(package_name, arch = nil)
|
@@ -361,12 +361,12 @@ class Chef
|
|
361
361
|
# ['atk = 1.12.2-1.fc6', 'libatk-1.0.so.0']
|
362
362
|
string.split(", ").each do |seg|
|
363
363
|
# 'atk = 1.12.2-1.fc6'
|
364
|
-
if seg =~
|
364
|
+
if seg =~ /^'(.*)'$/
|
365
365
|
ret << RPMProvide.parse($1)
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
|
-
|
369
|
+
ret
|
370
370
|
end
|
371
371
|
|
372
372
|
end # YumCache
|
@@ -35,7 +35,7 @@ class Chef
|
|
35
35
|
candidate_version = current_version = nil
|
36
36
|
is_installed = false
|
37
37
|
Chef::Log.debug("#{new_resource} checking zypper")
|
38
|
-
status =
|
38
|
+
status = shell_out_compact_timeout!("zypper", "--non-interactive", "info", package_name)
|
39
39
|
status.stdout.each_line do |line|
|
40
40
|
case line
|
41
41
|
when /^Version *: (.+) *$/
|
@@ -77,14 +77,14 @@ class Chef
|
|
77
77
|
|
78
78
|
def package_locked(name, version)
|
79
79
|
islocked = false
|
80
|
-
locked =
|
80
|
+
locked = shell_out_compact_timeout!("zypper", "locks")
|
81
81
|
locked.stdout.each_line do |line|
|
82
82
|
line_package = line.split("|").shift(2).last.strip
|
83
83
|
if line_package == name
|
84
84
|
islocked = true
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
87
|
+
islocked
|
88
88
|
end
|
89
89
|
|
90
90
|
def load_current_resource
|
@@ -103,7 +103,7 @@ class Chef
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def install_package(name, version)
|
106
|
-
zypper_package("install --auto-agree-with-licenses", name, version)
|
106
|
+
zypper_package("install", "--auto-agree-with-licenses", name, version)
|
107
107
|
end
|
108
108
|
|
109
109
|
def upgrade_package(name, version)
|
@@ -116,7 +116,7 @@ class Chef
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def purge_package(name, version)
|
119
|
-
zypper_package("remove --clean-deps", name, version)
|
119
|
+
zypper_package("remove", "--clean-deps", name, version)
|
120
120
|
end
|
121
121
|
|
122
122
|
def lock_package(name, version)
|
@@ -135,24 +135,24 @@ class Chef
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
def zypper_package(command, names, versions)
|
138
|
+
def zypper_package(command, *options, names, versions)
|
139
139
|
zipped_names = zip(names, versions)
|
140
140
|
if zypper_version < 1.0
|
141
|
-
|
141
|
+
shell_out_compact_timeout!("zypper", gpg_checks, command, *options, "-y", names)
|
142
142
|
else
|
143
|
-
|
143
|
+
shell_out_compact_timeout!("zypper", "--non-interactive", gpg_checks, command, *options, zipped_names)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
def gpg_checks
|
148
148
|
case Chef::Config[:zypper_check_gpg]
|
149
149
|
when true
|
150
|
-
|
150
|
+
nil
|
151
151
|
when false
|
152
152
|
"--no-gpg-checks"
|
153
153
|
when nil
|
154
|
-
Chef::Log.warn("Chef::Config[:zypper_check_gpg] was not set. "
|
155
|
-
"All packages will be installed without gpg signature checks. "
|
154
|
+
Chef::Log.warn("Chef::Config[:zypper_check_gpg] was not set. " \
|
155
|
+
"All packages will be installed without gpg signature checks. " \
|
156
156
|
"This is a security hazard.")
|
157
157
|
"--no-gpg-checks"
|
158
158
|
end
|
@@ -60,8 +60,8 @@ class Chef
|
|
60
60
|
def flags
|
61
61
|
interpreter_flags = [*default_interpreter_flags].join(" ")
|
62
62
|
|
63
|
-
if ! (
|
64
|
-
interpreter_flags = [
|
63
|
+
if ! (new_resource.flags.nil?)
|
64
|
+
interpreter_flags = [new_resource.flags, interpreter_flags].join(" ")
|
65
65
|
end
|
66
66
|
|
67
67
|
interpreter_flags
|
@@ -73,8 +73,8 @@ class Chef
|
|
73
73
|
# special handling to cover common use cases.
|
74
74
|
def add_exit_status_wrapper
|
75
75
|
self.code = wrapper_script
|
76
|
-
Chef::Log.debug("powershell_script provider called with script code:\n\n#{
|
77
|
-
Chef::Log.debug("powershell_script provider will execute transformed code:\n\n#{
|
76
|
+
Chef::Log.debug("powershell_script provider called with script code:\n\n#{new_resource.code}\n")
|
77
|
+
Chef::Log.debug("powershell_script provider will execute transformed code:\n\n#{code}\n")
|
78
78
|
end
|
79
79
|
|
80
80
|
def validate_script_syntax!
|
@@ -87,7 +87,7 @@ class Chef
|
|
87
87
|
# actually running the script.
|
88
88
|
user_code_wrapped_in_powershell_script_block = <<-EOH
|
89
89
|
{
|
90
|
-
#{
|
90
|
+
#{new_resource.code}
|
91
91
|
}
|
92
92
|
EOH
|
93
93
|
user_script_file.puts user_code_wrapped_in_powershell_script_block
|
@@ -149,6 +149,14 @@ EOH
|
|
149
149
|
<<-EOH
|
150
150
|
# Chef Client wrapper for powershell_script resources
|
151
151
|
|
152
|
+
# In rare cases, such as when PowerShell is executed
|
153
|
+
# as an alternate user, the new-variable cmdlet is not
|
154
|
+
# available, so import it just in case
|
155
|
+
if ( get-module -ListAvailable Microsoft.PowerShell.Utility )
|
156
|
+
{
|
157
|
+
Import-Module Microsoft.PowerShell.Utility
|
158
|
+
}
|
159
|
+
|
152
160
|
# LASTEXITCODE can be uninitialized -- make it explictly 0
|
153
161
|
# to avoid incorrect detection of failure (non-zero) codes
|
154
162
|
$global:LASTEXITCODE = 0
|
@@ -159,7 +167,7 @@ $global:LASTEXITCODE = 0
|
|
159
167
|
trap [Exception] {write-error ($_.Exception.Message);exit 1}
|
160
168
|
|
161
169
|
# Variable state that should not be accessible to the user code
|
162
|
-
new-variable -name interpolatedexitcode -visibility private -value $#{
|
170
|
+
new-variable -name interpolatedexitcode -visibility private -value $#{new_resource.convert_boolean_return}
|
163
171
|
new-variable -name chefscriptresult -visibility private
|
164
172
|
|
165
173
|
# Initialize a variable we use to capture $? inside a block
|
@@ -168,7 +176,7 @@ $global:lastcmdlet = $null
|
|
168
176
|
# Execute the user's code in a script block --
|
169
177
|
$chefscriptresult =
|
170
178
|
{
|
171
|
-
#{
|
179
|
+
#{new_resource.code}
|
172
180
|
|
173
181
|
# This assignment doesn't affect the block's return value
|
174
182
|
$global:lastcmdlet = $?
|
data/lib/chef/provider/reboot.rb
CHANGED
@@ -29,31 +29,31 @@ class Chef
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def load_current_resource
|
32
|
-
@current_resource ||= Chef::Resource::Reboot.new(
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
@current_resource ||= Chef::Resource::Reboot.new(new_resource.name)
|
33
|
+
current_resource.reason(new_resource.reason)
|
34
|
+
current_resource.delay_mins(new_resource.delay_mins)
|
35
|
+
current_resource
|
36
36
|
end
|
37
37
|
|
38
38
|
def request_reboot
|
39
39
|
node.run_context.request_reboot(
|
40
|
-
:delay_mins =>
|
41
|
-
:reason =>
|
40
|
+
:delay_mins => new_resource.delay_mins,
|
41
|
+
:reason => new_resource.reason,
|
42
42
|
:timestamp => Time.now,
|
43
|
-
:requested_by =>
|
43
|
+
:requested_by => new_resource.name
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
47
47
|
def action_request_reboot
|
48
48
|
converge_by("request a system reboot to occur if the run succeeds") do
|
49
|
-
Chef::Log.warn "Reboot requested:'#{
|
49
|
+
Chef::Log.warn "Reboot requested:'#{new_resource.name}'"
|
50
50
|
request_reboot
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def action_reboot_now
|
55
55
|
converge_by("rebooting the system immediately") do
|
56
|
-
Chef::Log.warn "Rebooting system immediately, requested by '#{
|
56
|
+
Chef::Log.warn "Rebooting system immediately, requested by '#{new_resource.name}'"
|
57
57
|
request_reboot
|
58
58
|
throw :end_client_run_early
|
59
59
|
end
|
@@ -61,7 +61,7 @@ class Chef
|
|
61
61
|
|
62
62
|
def action_cancel
|
63
63
|
converge_by("cancel any existing end-of-run reboot request") do
|
64
|
-
Chef::Log.warn "Reboot canceled: '#{
|
64
|
+
Chef::Log.warn "Reboot canceled: '#{new_resource.name}'"
|
65
65
|
node.run_context.cancel_reboot
|
66
66
|
end
|
67
67
|
end
|