chef 18.11.11 → 19.1.164
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 +25 -27
- data/README.md +7 -2
- data/Rakefile +1 -12
- data/chef-universal-mingw-ucrt.gemspec +3 -5
- data/chef.gemspec +22 -27
- data/lib/chef/action_collection.rb +3 -1
- data/lib/chef/api_client/registration.rb +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/api_client_v1.rb +1 -1
- data/lib/chef/application/apply.rb +30 -3
- data/lib/chef/application/base.rb +34 -3
- data/lib/chef/application/client.rb +15 -1
- data/lib/chef/application/exit_code.rb +3 -1
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/application.rb +6 -1
- data/lib/chef/chef_class.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/command_line.rb +7 -6
- data/lib/chef/chef_fs/config.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policies_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/exceptions.rb +1 -1
- data/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acl.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +7 -6
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_key.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/clients_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/container.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/containers_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/cookbook_artifacts_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bag.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bags_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/environment.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/group.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/node.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy_group.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/role.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/roles_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/user.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/users_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/versioned_cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system_cache.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +1 -1
- data/lib/chef/client.rb +13 -3
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/fetcher/chef_server.rb +1 -1
- data/lib/chef/compliance/input.rb +1 -1
- data/lib/chef/compliance/input_collection.rb +1 -1
- data/lib/chef/compliance/profile.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +1 -1
- data/lib/chef/compliance/runner.rb +20 -20
- data/lib/chef/compliance/waiver.rb +1 -1
- data/lib/chef/compliance/waiver_collection.rb +1 -1
- data/lib/chef/config.rb +1 -1
- data/lib/chef/constants.rb +1 -1
- data/lib/chef/context.rb +53 -0
- data/lib/chef/cookbook/chefignore.rb +2 -2
- data/lib/chef/cookbook/cookbook_collection.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +2 -1
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/cookbook/file_vendor.rb +1 -1
- data/lib/chef/cookbook/gem_installer.rb +1 -1
- data/lib/chef/cookbook/manifest_v0.rb +1 -1
- data/lib/chef/cookbook/manifest_v2.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +5 -0
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_loader.rb +1 -1
- data/lib/chef/cookbook_manifest.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/daemon.rb +1 -1
- data/lib/chef/data_bag.rb +3 -3
- data/lib/chef/data_bag_item.rb +2 -2
- data/lib/chef/data_collector/config_validation.rb +1 -1
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/data_collector/message_helpers.rb +1 -1
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/data_collector/run_start_message.rb +2 -2
- data/lib/chef/data_collector.rb +2 -2
- data/lib/chef/decorator/lazy.rb +1 -1
- data/lib/chef/decorator/lazy_array.rb +1 -1
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/delayed_evaluator.rb +1 -1
- data/lib/chef/deprecated.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +1 -1
- data/lib/chef/digester.rb +1 -1
- data/lib/chef/dsl/chef_vault.rb +2 -2
- data/lib/chef/dsl/cheffish.rb +1 -1
- data/lib/chef/dsl/compliance.rb +1 -1
- data/lib/chef/dsl/data_query.rb +1 -1
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/include_attribute.rb +1 -1
- data/lib/chef/dsl/include_recipe.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +1 -1
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/dsl/reader_helpers.rb +3 -1
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/recipe.rb +1 -1
- data/lib/chef/dsl/registry_helper.rb +1 -1
- data/lib/chef/dsl/render_helpers.rb +1 -1
- data/lib/chef/dsl/resources.rb +1 -1
- data/lib/chef/dsl/rest_resource.rb +17 -64
- data/lib/chef/dsl/secret.rb +1 -1
- data/lib/chef/dsl/universal.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/decryption_failure.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/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/unsupported_cipher.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format.rb +1 -1
- data/lib/chef/encrypted_data_bag_item.rb +1 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/event_loggers/base.rb +1 -1
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +2 -12
- data/lib/chef/file_access_control/unix.rb +10 -10
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/file_access_control.rb +1 -1
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/file_content_management/content_base.rb +1 -1
- data/lib/chef/file_content_management/deploy/cp.rb +1 -1
- data/lib/chef/file_content_management/deploy/mv_unix.rb +1 -1
- data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
- data/lib/chef/file_content_management/deploy/target_io.rb +27 -0
- data/lib/chef/file_content_management/deploy.rb +5 -2
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/base.rb +1 -1
- data/lib/chef/formatters/error_description.rb +2 -9
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +1 -1
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +3 -2
- data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +3 -2
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_mapper.rb +1 -1
- data/lib/chef/group.rb +1 -1
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +1 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +1 -1
- data/lib/chef/guard_interpreter.rb +1 -1
- data/lib/chef/handler/error_report.rb +1 -1
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/handler/slow_report.rb +1 -1
- data/lib/chef/handler.rb +1 -1
- data/lib/chef/http/api_versions.rb +1 -1
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/authenticator.rb +13 -26
- data/lib/chef/http/basic_client.rb +1 -2
- data/lib/chef/http/cookie_jar.rb +1 -1
- data/lib/chef/http/cookie_manager.rb +1 -1
- data/lib/chef/http/decompressor.rb +1 -1
- data/lib/chef/http/http_request.rb +17 -16
- data/lib/chef/http/json_input.rb +1 -1
- data/lib/chef/http/json_output.rb +1 -1
- data/lib/chef/http/json_to_model_output.rb +1 -1
- data/lib/chef/http/remote_request_id.rb +1 -1
- data/lib/chef/http/simple.rb +1 -1
- data/lib/chef/http/simple_json.rb +1 -1
- data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
- data/lib/chef/http/ssl_policies.rb +1 -1
- data/lib/chef/http/validate_content_length.rb +1 -1
- data/lib/chef/http.rb +1 -2
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/key.rb +1 -1
- data/lib/chef/licensing.rb +105 -0
- data/lib/chef/licensing_config.rb +20 -0
- data/lib/chef/local_mode.rb +1 -1
- data/lib/chef/log/syslog.rb +1 -1
- data/lib/chef/log/winevt.rb +1 -1
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +1 -1
- data/lib/chef/mixin/checksum.rb +1 -1
- data/lib/chef/mixin/chef_utils_wiring.rb +1 -1
- data/lib/chef/mixin/convert_to_class_name.rb +1 -1
- data/lib/chef/mixin/create_path.rb +1 -1
- data/lib/chef/mixin/deep_merge.rb +1 -1
- data/lib/chef/mixin/default_paths.rb +1 -1
- data/lib/chef/mixin/deprecation.rb +1 -1
- data/lib/chef/mixin/enforce_ownership_and_permissions.rb +1 -1
- data/lib/chef/mixin/file_class.rb +4 -2
- data/lib/chef/mixin/from_file.rb +1 -1
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/homebrew.rb +3 -4
- data/lib/chef/mixin/lazy_module_include.rb +1 -1
- data/lib/chef/mixin/notifying_block.rb +1 -1
- data/lib/chef/mixin/openssl_helper.rb +1 -1
- data/lib/chef/mixin/params_validate.rb +1 -1
- data/lib/chef/mixin/path_sanity.rb +1 -1
- data/lib/chef/mixin/powershell_exec.rb +1 -1
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
- data/lib/chef/mixin/proxified_socket.rb +1 -1
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/mixin/subclass_directive.rb +1 -1
- data/lib/chef/mixin/template.rb +3 -25
- data/lib/chef/mixin/unformatter.rb +1 -1
- data/lib/chef/mixin/uris.rb +1 -1
- data/lib/chef/mixin/user_context.rb +1 -1
- data/lib/chef/mixin/versioned_api.rb +1 -1
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/mixin/why_run.rb +1 -1
- data/lib/chef/mixin/wide_string.rb +1 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +1 -1
- data/lib/chef/mixin/windows_env_helper.rb +1 -1
- data/lib/chef/mixin/xml_escape.rb +1 -1
- data/lib/chef/monkey_patches/net-http.rb +10 -11
- data/lib/chef/monkey_patches/win32/registry.rb +1 -1
- data/lib/chef/node/attribute.rb +1 -1
- data/lib/chef/node/attribute_collections.rb +1 -1
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +1 -1
- data/lib/chef/node/mixin/deep_merge_cache.rb +1 -1
- data/lib/chef/node/mixin/immutablize_array.rb +27 -1
- data/lib/chef/node/mixin/immutablize_hash.rb +36 -1
- data/lib/chef/node/mixin/mashy_array.rb +1 -1
- data/lib/chef/node/mixin/state_tracking.rb +1 -1
- data/lib/chef/node/mixin/state_tracking_array.rb +1 -1
- data/lib/chef/node.rb +1 -1
- data/lib/chef/node_map.rb +15 -3
- data/lib/chef/null_logger.rb +1 -1
- data/lib/chef/org.rb +1 -1
- data/lib/chef/platform/priority_map.rb +1 -1
- data/lib/chef/platform/provider_handler_map.rb +1 -1
- data/lib/chef/platform/provider_mapping.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/platform/rebooter.rb +1 -1
- data/lib/chef/platform/resource_handler_map.rb +1 -1
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/platform.rb +1 -1
- data/lib/chef/policy_builder/dynamic.rb +1 -1
- data/lib/chef/policy_builder/expand_node_object.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/policy_builder.rb +1 -1
- data/lib/chef/property.rb +3 -3
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/cookbook_file/content.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +2 -2
- data/lib/chef/provider/cron/aix.rb +1 -1
- data/lib/chef/provider/cron/solaris.rb +1 -1
- data/lib/chef/provider/cron.rb +15 -5
- data/lib/chef/provider/directory.rb +18 -18
- data/lib/chef/provider/dsc_resource.rb +1 -1
- data/lib/chef/provider/dsc_script.rb +1 -1
- data/lib/chef/provider/execute.rb +3 -2
- data/lib/chef/provider/file/content.rb +3 -4
- data/lib/chef/provider/file.rb +44 -31
- data/lib/chef/provider/git.rb +10 -10
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +2 -2
- data/lib/chef/provider/group/gpasswd.rb +3 -3
- data/lib/chef/provider/group/groupadd.rb +2 -2
- data/lib/chef/provider/group/groupmod.rb +3 -3
- data/lib/chef/provider/group/pw.rb +3 -3
- data/lib/chef/provider/group/solaris.rb +3 -3
- data/lib/chef/provider/group/usermod.rb +3 -3
- data/lib/chef/provider/group.rb +2 -2
- data/lib/chef/provider/http_request.rb +3 -4
- data/lib/chef/provider/ifconfig/aix.rb +2 -2
- data/lib/chef/provider/ifconfig/debian.rb +3 -3
- data/lib/chef/provider/ifconfig/redhat.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +1 -1
- data/lib/chef/provider/link.rb +22 -11
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/mount/aix.rb +5 -5
- data/lib/chef/provider/mount/linux.rb +4 -4
- data/lib/chef/provider/mount/mount.rb +12 -12
- data/lib/chef/provider/mount/solaris.rb +1 -1
- data/lib/chef/provider/mount/windows.rb +3 -3
- data/lib/chef/provider/mount.rb +1 -1
- data/lib/chef/provider/noop.rb +1 -1
- data/lib/chef/provider/package/apt.rb +1 -1
- data/lib/chef/provider/package/bff.rb +4 -4
- data/lib/chef/provider/package/cab.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +20 -79
- data/lib/chef/provider/package/deb.rb +1 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +65 -355
- data/lib/chef/provider/package/dnf/python_helper.rb +5 -8
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +5 -24
- data/lib/chef/provider/package/dpkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/base.rb +1 -1
- data/lib/chef/provider/package/habitat.rb +6 -6
- data/lib/chef/provider/package/homebrew.rb +1 -1
- data/lib/chef/provider/package/ips.rb +3 -3
- data/lib/chef/provider/package/msu.rb +1 -1
- data/lib/chef/provider/package/openbsd.rb +3 -2
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/paludis.rb +3 -3
- data/lib/chef/provider/package/portage.rb +3 -3
- data/lib/chef/provider/package/powershell.rb +1 -1
- data/lib/chef/provider/package/rpm.rb +3 -3
- data/lib/chef/provider/package/rubygems.rb +21 -28
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/package/snap.rb +19 -7
- data/lib/chef/provider/package/snap_tm.rb +79 -0
- data/lib/chef/provider/package/solaris.rb +5 -5
- data/lib/chef/provider/package/windows/exe.rb +1 -1
- data/lib/chef/provider/package/windows/msi.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
- data/lib/chef/provider/package/windows.rb +1 -1
- data/lib/chef/provider/package/yum/python_helper.rb +1 -1
- data/lib/chef/provider/package/yum/rpm_utils.rb +1 -1
- data/lib/chef/provider/package/yum/version.rb +1 -1
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/package/yum.rb +2 -2
- data/lib/chef/provider/package/yum_tm.rb +132 -0
- data/lib/chef/provider/package/zypper/version.rb +1 -1
- data/lib/chef/provider/package/zypper.rb +5 -5
- data/lib/chef/provider/package.rb +2 -2
- data/lib/chef/provider/powershell_script.rb +85 -85
- data/lib/chef/provider/registry_key.rb +2 -1
- data/lib/chef/provider/remote_directory.rb +6 -6
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
- data/lib/chef/provider/remote_file/content.rb +1 -1
- data/lib/chef/provider/remote_file/fetcher.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +2 -3
- data/lib/chef/provider/remote_file.rb +2 -2
- data/lib/chef/provider/route.rb +10 -10
- data/lib/chef/provider/ruby_block.rb +1 -1
- data/lib/chef/provider/script.rb +8 -8
- data/lib/chef/provider/service/aix.rb +2 -2
- data/lib/chef/provider/service/aixinit.rb +6 -6
- data/lib/chef/provider/service/arch.rb +6 -6
- data/lib/chef/provider/service/debian.rb +8 -8
- data/lib/chef/provider/service/freebsd.rb +7 -7
- data/lib/chef/provider/service/gentoo.rb +6 -6
- data/lib/chef/provider/service/init.rb +3 -3
- data/lib/chef/provider/service/insserv.rb +3 -3
- data/lib/chef/provider/service/invokercd.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +1 -1
- data/lib/chef/provider/service/openbsd.rb +7 -7
- data/lib/chef/provider/service/redhat.rb +6 -6
- data/lib/chef/provider/service/solaris.rb +3 -3
- data/lib/chef/provider/service/systemd.rb +3 -3
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +1 -1
- data/lib/chef/provider/service.rb +1 -1
- data/lib/chef/provider/subversion.rb +10 -10
- data/lib/chef/provider/systemd_unit.rb +3 -3
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/template.rb +2 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user/aix.rb +4 -4
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/provider/user/linux.rb +8 -3
- data/lib/chef/provider/user/mac.rb +2 -2
- data/lib/chef/provider/user/pw.rb +4 -4
- data/lib/chef/provider/user/solaris.rb +8 -8
- data/lib/chef/provider/user.rb +7 -4
- data/lib/chef/provider/windows_script.rb +2 -2
- data/lib/chef/provider/yum_repository.rb +2 -4
- data/lib/chef/provider/zypper_repository.rb +2 -2
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/providers.rb +3 -1
- data/lib/chef/pwsh.rb +1 -1
- data/lib/chef/recipe.rb +9 -6
- data/lib/chef/request_id.rb +1 -1
- data/lib/chef/resource/_rest_resource.rb +158 -15
- data/lib/chef/resource/action_class.rb +1 -1
- data/lib/chef/resource/alternatives.rb +44 -43
- data/lib/chef/resource/apt_package.rb +38 -33
- data/lib/chef/resource/apt_preference.rb +25 -24
- data/lib/chef/resource/apt_repository.rb +16 -11
- data/lib/chef/resource/apt_update.rb +5 -4
- data/lib/chef/resource/archive_file.rb +6 -40
- data/lib/chef/resource/bash.rb +132 -131
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +18 -17
- data/lib/chef/resource/breakpoint.rb +46 -45
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/cab_package.rb +23 -23
- data/lib/chef/resource/chef_client_config.rb +88 -253
- data/lib/chef/resource/chef_client_cron.rb +21 -19
- data/lib/chef/resource/chef_client_hab_ca_cert.rb +141 -0
- data/lib/chef/resource/chef_client_launchd.rb +6 -2
- data/lib/chef/resource/chef_client_scheduled_task.rb +35 -32
- data/lib/chef/resource/chef_client_systemd_timer.rb +21 -18
- data/lib/chef/resource/chef_client_trusted_certificate.rb +29 -29
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/chef_handler.rb +108 -108
- data/lib/chef/resource/chef_sleep.rb +3 -2
- data/lib/chef/resource/chef_vault_secret.rb +2 -2
- data/lib/chef/resource/chocolatey_config.rb +15 -15
- data/lib/chef/resource/chocolatey_feature.rb +2 -2
- data/lib/chef/resource/chocolatey_installer.rb +39 -72
- data/lib/chef/resource/chocolatey_package.rb +2 -2
- data/lib/chef/resource/chocolatey_source.rb +16 -16
- data/lib/chef/resource/conditional.rb +1 -1
- data/lib/chef/resource/cookbook_file.rb +3 -2
- data/lib/chef/resource/cron/_cron_shared.rb +1 -1
- data/lib/chef/resource/cron/cron.rb +72 -71
- data/lib/chef/resource/cron/cron_d.rb +3 -2
- data/lib/chef/resource/cron_access.rb +3 -2
- data/lib/chef/resource/csh.rb +3 -2
- data/lib/chef/resource/directory.rb +4 -3
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +2 -2
- data/lib/chef/resource/dpkg_package.rb +9 -6
- data/lib/chef/resource/dsc_resource.rb +1 -1
- data/lib/chef/resource/dsc_script.rb +1 -1
- data/lib/chef/resource/execute.rb +8 -1
- data/lib/chef/resource/file/verification/json.rb +1 -1
- data/lib/chef/resource/file/verification/systemd_unit.rb +5 -2
- data/lib/chef/resource/file/verification/yaml.rb +2 -2
- data/lib/chef/resource/file/verification.rb +4 -1
- data/lib/chef/resource/file.rb +3 -2
- data/lib/chef/resource/freebsd_package.rb +4 -3
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/group.rb +33 -30
- data/lib/chef/resource/habitat/_habitat_shared.rb +1 -1
- data/lib/chef/resource/habitat/habitat_package.rb +84 -82
- data/lib/chef/resource/habitat/habitat_sup.rb +98 -97
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +14 -13
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +5 -4
- data/lib/chef/resource/habitat_config.rb +38 -24
- data/lib/chef/resource/habitat_install.rb +22 -22
- data/lib/chef/resource/habitat_service.rb +10 -6
- data/lib/chef/resource/habitat_user_toml.rb +12 -12
- data/lib/chef/resource/helpers/cron_validations.rb +1 -1
- data/lib/chef/resource/helpers/path_helpers.rb +52 -0
- data/lib/chef/resource/homebrew_cask.rb +1 -1
- data/lib/chef/resource/homebrew_package.rb +21 -21
- data/lib/chef/resource/homebrew_tap.rb +10 -2
- data/lib/chef/resource/homebrew_update.rb +1 -1
- data/lib/chef/resource/hostname.rb +14 -11
- data/lib/chef/resource/http_request.rb +5 -4
- data/lib/chef/resource/ifconfig.rb +36 -35
- data/lib/chef/resource/inspec_input.rb +42 -39
- data/lib/chef/resource/inspec_waiver.rb +66 -65
- data/lib/chef/resource/inspec_waiver_file_entry.rb +28 -27
- data/lib/chef/resource/ips_package.rb +4 -3
- data/lib/chef/resource/kernel_module.rb +4 -3
- data/lib/chef/resource/ksh.rb +3 -2
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/link.rb +4 -3
- data/lib/chef/resource/locale.rb +11 -10
- data/lib/chef/resource/log.rb +3 -1
- data/lib/chef/resource/lwrp_base.rb +1 -1
- data/lib/chef/resource/macos_pkg.rb +1 -1
- data/lib/chef/resource/macos_userdefaults.rb +1 -1
- data/lib/chef/resource/macports_package.rb +1 -1
- data/lib/chef/resource/mdadm.rb +33 -33
- data/lib/chef/resource/mount.rb +7 -5
- data/lib/chef/resource/msu_package.rb +2 -2
- data/lib/chef/resource/notify_group.rb +3 -2
- data/lib/chef/resource/ohai.rb +37 -36
- data/lib/chef/resource/ohai_hint.rb +27 -26
- data/lib/chef/resource/openbsd_package.rb +4 -3
- data/lib/chef/resource/openssl_dhparam.rb +1 -1
- data/lib/chef/resource/openssl_ec_private_key.rb +2 -2
- data/lib/chef/resource/openssl_ec_public_key.rb +3 -3
- data/lib/chef/resource/openssl_rsa_private_key.rb +2 -2
- data/lib/chef/resource/openssl_rsa_public_key.rb +3 -3
- data/lib/chef/resource/openssl_x509_certificate.rb +7 -3
- data/lib/chef/resource/openssl_x509_crl.rb +16 -16
- data/lib/chef/resource/openssl_x509_request.rb +3 -3
- data/lib/chef/resource/package.rb +4 -3
- data/lib/chef/resource/pacman_package.rb +2 -1
- data/lib/chef/resource/paludis_package.rb +3 -2
- data/lib/chef/resource/perl.rb +3 -2
- data/lib/chef/resource/plist.rb +4 -4
- data/lib/chef/resource/portage_package.rb +3 -2
- data/lib/chef/resource/powershell_package.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +12 -12
- data/lib/chef/resource/powershell_script.rb +1 -1
- data/lib/chef/resource/python.rb +3 -2
- data/lib/chef/resource/reboot.rb +3 -2
- data/lib/chef/resource/registry_key.rb +78 -83
- data/lib/chef/resource/remote_directory.rb +3 -2
- data/lib/chef/resource/remote_file.rb +74 -73
- data/lib/chef/resource/resource_notification.rb +1 -1
- data/lib/chef/resource/rhsm_errata.rb +3 -2
- data/lib/chef/resource/rhsm_errata_level.rb +3 -2
- data/lib/chef/resource/rhsm_register.rb +14 -5
- data/lib/chef/resource/rhsm_repo.rb +5 -5
- data/lib/chef/resource/rhsm_subscription.rb +10 -10
- data/lib/chef/resource/route.rb +2 -1
- data/lib/chef/resource/rpm_package.rb +3 -2
- data/lib/chef/resource/ruby.rb +4 -2
- data/lib/chef/resource/ruby_block.rb +3 -1
- data/lib/chef/resource/scm/_scm.rb +1 -1
- data/lib/chef/resource/scm/git.rb +82 -81
- data/lib/chef/resource/scm/subversion.rb +12 -11
- data/lib/chef/resource/script.rb +4 -2
- data/lib/chef/resource/selinux/common_helpers.rb +1 -1
- data/lib/chef/resource/selinux/selinux_debian.erb +1 -1
- data/lib/chef/resource/selinux/selinux_default.erb +1 -1
- data/lib/chef/resource/selinux_boolean.rb +14 -13
- data/lib/chef/resource/selinux_fcontext.rb +23 -22
- data/lib/chef/resource/selinux_install.rb +20 -19
- data/lib/chef/resource/selinux_login.rb +13 -12
- data/lib/chef/resource/selinux_module.rb +20 -19
- data/lib/chef/resource/selinux_permissive.rb +10 -9
- data/lib/chef/resource/selinux_port.rb +17 -16
- data/lib/chef/resource/selinux_state.rb +29 -28
- data/lib/chef/resource/selinux_user.rb +16 -15
- data/lib/chef/resource/service.rb +9 -6
- data/lib/chef/resource/smartos_package.rb +4 -3
- data/lib/chef/resource/snap_package.rb +32 -23
- data/lib/chef/resource/solaris_package.rb +3 -2
- data/lib/chef/resource/ssh_known_hosts_entry.rb +13 -12
- data/lib/chef/resource/sudo.rb +71 -70
- data/lib/chef/resource/swap_file.rb +20 -19
- data/lib/chef/resource/sysctl.rb +49 -48
- data/lib/chef/resource/systemd_unit.rb +42 -39
- data/lib/chef/resource/template.rb +3 -2
- data/lib/chef/resource/timezone.rb +23 -22
- data/lib/chef/resource/user/aix_user.rb +4 -3
- data/lib/chef/resource/user/linux_user.rb +4 -4
- data/lib/chef/resource/user/mac_user.rb +5 -4
- data/lib/chef/resource/user/pw_user.rb +4 -3
- data/lib/chef/resource/user/solaris_user.rb +4 -3
- data/lib/chef/resource/user/windows_user.rb +2 -1
- data/lib/chef/resource/user.rb +8 -7
- data/lib/chef/resource/user_ulimit.rb +25 -24
- data/lib/chef/resource/windows_ad_join.rb +23 -23
- data/lib/chef/resource/windows_audit_policy.rb +35 -35
- data/lib/chef/resource/windows_auto_run.rb +9 -9
- data/lib/chef/resource/windows_certificate.rb +21 -21
- data/lib/chef/resource/windows_defender.rb +23 -23
- data/lib/chef/resource/windows_defender_exclusion.rb +18 -18
- data/lib/chef/resource/windows_dfs_folder.rb +1 -1
- data/lib/chef/resource/windows_dfs_namespace.rb +1 -1
- data/lib/chef/resource/windows_dfs_server.rb +1 -1
- data/lib/chef/resource/windows_dns_record.rb +1 -1
- data/lib/chef/resource/windows_dns_zone.rb +1 -1
- data/lib/chef/resource/windows_env.rb +6 -6
- data/lib/chef/resource/windows_feature.rb +43 -43
- data/lib/chef/resource/windows_feature_dism.rb +9 -9
- data/lib/chef/resource/windows_feature_powershell.rb +21 -21
- data/lib/chef/resource/windows_firewall_profile.rb +29 -29
- data/lib/chef/resource/windows_firewall_rule.rb +48 -48
- data/lib/chef/resource/windows_font.rb +7 -7
- data/lib/chef/resource/windows_package.rb +59 -59
- data/lib/chef/resource/windows_pagefile.rb +30 -30
- data/lib/chef/resource/windows_path.rb +13 -13
- data/lib/chef/resource/windows_printer.rb +29 -29
- data/lib/chef/resource/windows_printer_port.rb +22 -22
- data/lib/chef/resource/windows_script.rb +1 -1
- data/lib/chef/resource/windows_security_policy.rb +24 -24
- data/lib/chef/resource/windows_service.rb +108 -108
- data/lib/chef/resource/windows_share.rb +17 -17
- data/lib/chef/resource/windows_shortcut.rb +8 -8
- data/lib/chef/resource/windows_task.rb +104 -106
- data/lib/chef/resource/windows_uac.rb +15 -15
- data/lib/chef/resource/windows_update_settings.rb +27 -27
- data/lib/chef/resource/windows_user_privilege.rb +59 -59
- data/lib/chef/resource/windows_workgroup.rb +11 -11
- data/lib/chef/resource/yum_package.rb +6 -5
- data/lib/chef/resource/yum_repository.rb +39 -38
- data/lib/chef/resource/zypper_package.rb +3 -2
- data/lib/chef/resource/zypper_repository.rb +4 -3
- data/lib/chef/resource.rb +11 -3
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +1 -1
- data/lib/chef/resource_collection/resource_list.rb +1 -1
- data/lib/chef/resource_collection/resource_set.rb +10 -4
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_definition.rb +1 -1
- data/lib/chef/resource_definition_list.rb +1 -1
- data/lib/chef/resource_inspector.rb +3 -1
- data/lib/chef/resource_reporter.rb +2 -1
- data/lib/chef/resource_resolver.rb +1 -1
- data/lib/chef/resources.rb +2 -2
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/run_context.rb +2 -2
- data/lib/chef/run_list/run_list_expansion.rb +1 -1
- data/lib/chef/run_list/run_list_item.rb +5 -5
- data/lib/chef/run_list/versioned_recipe_list.rb +1 -1
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/run_lock.rb +4 -1
- data/lib/chef/run_status.rb +1 -1
- data/lib/chef/runner.rb +1 -1
- data/lib/chef/scan_access_control.rb +9 -7
- data/lib/chef/search/query.rb +1 -1
- data/lib/chef/secret_fetcher/akeyless_vault.rb +1 -1
- data/lib/chef/secret_fetcher/aws_secrets_manager.rb +1 -1
- data/lib/chef/secret_fetcher/base.rb +1 -1
- data/lib/chef/secret_fetcher/example.rb +1 -1
- data/lib/chef/secret_fetcher/hashi_vault.rb +10 -1
- data/lib/chef/secret_fetcher.rb +1 -1
- data/lib/chef/server_api.rb +1 -1
- data/lib/chef/server_api_versions.rb +1 -1
- data/lib/chef/shell/ext.rb +20 -20
- data/lib/chef/shell/model_wrapper.rb +1 -1
- data/lib/chef/shell/shell_session.rb +2 -2
- data/lib/chef/shell.rb +30 -15
- data/lib/chef/target_io/dir.rb +12 -0
- data/lib/chef/target_io/etc.rb +16 -0
- data/lib/chef/target_io/file.rb +12 -0
- data/lib/chef/target_io/fileutils.rb +12 -0
- data/lib/chef/target_io/http.rb +35 -0
- data/lib/chef/target_io/io.rb +12 -0
- data/lib/chef/target_io/shadow.rb +44 -0
- data/lib/chef/target_io/support.rb +73 -0
- data/lib/chef/target_io/train/dir.rb +86 -0
- data/lib/chef/target_io/train/etc.rb +108 -0
- data/lib/chef/target_io/train/file.rb +219 -0
- data/lib/chef/target_io/train/fileutils.rb +201 -0
- data/lib/chef/target_io/train/http.rb +117 -0
- data/lib/chef/target_io/train/io.rb +13 -0
- data/lib/chef/target_io/train/shadow.rb +54 -0
- data/lib/chef/target_io/train_compat.rb +7 -0
- data/lib/chef/target_io.rb +11 -0
- data/lib/chef/train_transport.rb +1 -1
- data/lib/chef/user.rb +1 -1
- data/lib/chef/user_v1.rb +1 -1
- data/lib/chef/util/backup.rb +2 -2
- data/lib/chef/util/diff.rb +15 -2
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/dsc/local_configuration_manager.rb +1 -1
- data/lib/chef/util/dsc/resource_store.rb +1 -1
- data/lib/chef/util/editor.rb +1 -1
- data/lib/chef/util/file_edit.rb +5 -5
- data/lib/chef/util/path_helper.rb +1 -1
- data/lib/chef/util/powershell/ps_credential.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/threaded_job_queue.rb +1 -1
- data/lib/chef/util/windows/logon_session.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/command_line_helper.rb +1 -1
- data/lib/chef/win32/api/crypto.rb +1 -1
- data/lib/chef/win32/api/error.rb +1 -1
- data/lib/chef/win32/api/file.rb +3 -2
- data/lib/chef/win32/api/installer.rb +1 -1
- data/lib/chef/win32/api/memory.rb +1 -1
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/api/process.rb +1 -1
- data/lib/chef/win32/api/psapi.rb +1 -1
- data/lib/chef/win32/api/registry.rb +1 -1
- data/lib/chef/win32/api/security.rb +1 -1
- data/lib/chef/win32/api/synchronization.rb +1 -1
- data/lib/chef/win32/api/system.rb +1 -1
- data/lib/chef/win32/api/unicode.rb +1 -1
- data/lib/chef/win32/api.rb +1 -1
- data/lib/chef/win32/crypto.rb +1 -1
- data/lib/chef/win32/error.rb +3 -2
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/file/info.rb +1 -1
- data/lib/chef/win32/file/version_info.rb +1 -1
- data/lib/chef/win32/file.rb +1 -1
- data/lib/chef/win32/handle.rb +1 -1
- data/lib/chef/win32/memory.rb +1 -1
- data/lib/chef/win32/mutex.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/process.rb +1 -1
- data/lib/chef/win32/registry.rb +4 -2
- data/lib/chef/win32/security/ace.rb +1 -1
- data/lib/chef/win32/security/acl.rb +1 -1
- data/lib/chef/win32/security/securable_object.rb +1 -1
- data/lib/chef/win32/security/security_descriptor.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/lib/chef/win32/security/token.rb +1 -1
- data/lib/chef/win32/security.rb +1 -1
- data/lib/chef/win32/system.rb +1 -1
- data/lib/chef/win32/unicode.rb +1 -1
- data/lib/chef/win32/version.rb +2 -3
- data/lib/chef/workstation_config_loader.rb +1 -1
- data/lib/chef.rb +3 -1
- metadata +136 -120
- data/lib/chef/monkey_patches/reline-windows.rb +0 -116
- data/lib/chef/resource/osx_profile.rb +0 -334
|
@@ -1,97 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
#
|
|
3
|
-
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
|
-
# Copyright:: Copyright (c) 2026 Meta Platforms, Inc.
|
|
5
|
-
# Copyright:: Copyright (c) 2026 Phil Dibowitz
|
|
6
|
-
# License:: Apache License, Version 2.0
|
|
7
|
-
#
|
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
# you may not use this file except in compliance with the License.
|
|
10
|
-
# You may obtain a copy of the License at
|
|
11
|
-
#
|
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
#
|
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
# See the License for the specific language governing permissions and
|
|
18
|
-
# limitations under the License.
|
|
19
|
-
#
|
|
2
|
+
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
|
20
3
|
|
|
21
4
|
import sys
|
|
5
|
+
import dnf
|
|
6
|
+
import hawkey
|
|
22
7
|
import signal
|
|
23
8
|
import os
|
|
24
9
|
import json
|
|
25
10
|
|
|
26
|
-
# to enable debug logging, set the CHEF_DNF_HELPER_DEBUG_FILE environment
|
|
27
|
-
# variable to a file path
|
|
28
|
-
DEBUG_FILE = os.environ.get("CHEF_DNF_HELPER_DEBUG_FILE", None)
|
|
29
|
-
|
|
30
|
-
# Try to import dnf5 first, fall back to dnf4
|
|
31
|
-
try:
|
|
32
|
-
import libdnf5
|
|
33
|
-
import rpm
|
|
34
|
-
|
|
35
|
-
DNF_VERSION = 5
|
|
36
|
-
except ImportError:
|
|
37
|
-
try:
|
|
38
|
-
import dnf
|
|
39
|
-
import hawkey
|
|
40
|
-
|
|
41
|
-
DNF_VERSION = 4
|
|
42
|
-
except ImportError:
|
|
43
|
-
raise RuntimeError(
|
|
44
|
-
"Neither dnf5 (libdnf5) nor dnf4 (dnf) libraries are available"
|
|
45
|
-
)
|
|
46
|
-
|
|
47
11
|
base = None
|
|
48
12
|
|
|
49
|
-
|
|
50
|
-
def get_base_dnf5(command):
|
|
51
|
-
global base
|
|
52
|
-
if base is None:
|
|
53
|
-
base = libdnf5.base.Base()
|
|
54
|
-
|
|
55
|
-
# Load configuration
|
|
56
|
-
base.load_config()
|
|
57
|
-
|
|
58
|
-
# Set up vars
|
|
59
|
-
base.setup()
|
|
60
|
-
|
|
61
|
-
# Load repositories
|
|
62
|
-
repo_sack = base.get_repo_sack()
|
|
63
|
-
repo_sack.create_repos_from_system_configuration()
|
|
64
|
-
|
|
65
|
-
if "repos" in command:
|
|
66
|
-
for repo_pattern in command["repos"]:
|
|
67
|
-
if "enable" in repo_pattern:
|
|
68
|
-
query = libdnf5.repo.RepoQuery(base)
|
|
69
|
-
query.filter_id(
|
|
70
|
-
repo_pattern["enable"], libdnf5.common.QueryCmp_GLOB
|
|
71
|
-
)
|
|
72
|
-
for repo in query:
|
|
73
|
-
repo.enable()
|
|
74
|
-
if "disable" in repo_pattern:
|
|
75
|
-
query = libdnf5.repo.RepoQuery(base)
|
|
76
|
-
query.filter_id(
|
|
77
|
-
repo_pattern["disable"], libdnf5.common.QueryCmp_GLOB
|
|
78
|
-
)
|
|
79
|
-
for repo in query:
|
|
80
|
-
repo.disable()
|
|
81
|
-
|
|
82
|
-
# Load repositories and create solv files
|
|
83
|
-
repo_sack.load_repos()
|
|
84
|
-
|
|
85
|
-
return base
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def get_sack_dnf4(command):
|
|
13
|
+
def get_sack():
|
|
89
14
|
global base
|
|
90
15
|
if base is None:
|
|
91
16
|
base = dnf.Base()
|
|
92
17
|
conf = base.conf
|
|
93
18
|
conf.read()
|
|
94
|
-
conf.installroot =
|
|
19
|
+
conf.installroot = '/'
|
|
95
20
|
conf.assumeyes = True
|
|
96
21
|
subst = conf.substitutions
|
|
97
22
|
subst.update_from_etc(conf.installroot)
|
|
@@ -103,350 +28,136 @@ def get_sack_dnf4(command):
|
|
|
103
28
|
base.read_all_repos()
|
|
104
29
|
repos = base.repos
|
|
105
30
|
|
|
106
|
-
if
|
|
107
|
-
for repo_pattern in command[
|
|
108
|
-
if
|
|
109
|
-
for repo in repos.get_matching(repo_pattern[
|
|
31
|
+
if 'repos' in command:
|
|
32
|
+
for repo_pattern in command['repos']:
|
|
33
|
+
if 'enable' in repo_pattern:
|
|
34
|
+
for repo in repos.get_matching(repo_pattern['enable']):
|
|
110
35
|
repo.enable()
|
|
111
|
-
if
|
|
112
|
-
for repo in repos.get_matching(repo_pattern[
|
|
36
|
+
if 'disable' in repo_pattern:
|
|
37
|
+
for repo in repos.get_matching(repo_pattern['disable']):
|
|
113
38
|
repo.disable()
|
|
114
39
|
|
|
115
40
|
try:
|
|
116
41
|
base.configure_plugins()
|
|
117
42
|
except AttributeError:
|
|
118
43
|
pass
|
|
119
|
-
base.fill_sack(load_system_repo=
|
|
44
|
+
base.fill_sack(load_system_repo='auto')
|
|
120
45
|
return base.sack
|
|
121
46
|
|
|
122
|
-
|
|
123
|
-
def
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
47
|
+
# FIXME: leaks memory and does not work
|
|
48
|
+
def flushcache():
|
|
49
|
+
try:
|
|
50
|
+
os.remove('/var/cache/dnf/@System.solv')
|
|
51
|
+
except OSError:
|
|
52
|
+
pass
|
|
53
|
+
get_sack().load_system_repo(build_cache=True)
|
|
129
54
|
|
|
130
55
|
def version_tuple(versionstr):
|
|
131
|
-
e =
|
|
56
|
+
e = '0'
|
|
132
57
|
v = None
|
|
133
58
|
r = None
|
|
134
|
-
colon_index = versionstr.find(
|
|
59
|
+
colon_index = versionstr.find(':')
|
|
135
60
|
if colon_index > 0:
|
|
136
61
|
e = str(versionstr[:colon_index])
|
|
137
|
-
dash_index = versionstr.find(
|
|
62
|
+
dash_index = versionstr.find('-')
|
|
138
63
|
if dash_index > 0:
|
|
139
|
-
tmp = versionstr[colon_index + 1
|
|
140
|
-
if tmp !=
|
|
64
|
+
tmp = versionstr[colon_index + 1:dash_index]
|
|
65
|
+
if tmp != '':
|
|
141
66
|
v = tmp
|
|
142
|
-
arch_index = versionstr.rfind(
|
|
67
|
+
arch_index = versionstr.rfind('.', dash_index)
|
|
143
68
|
if arch_index > 0:
|
|
144
|
-
r = versionstr[dash_index + 1
|
|
69
|
+
r = versionstr[dash_index + 1:arch_index]
|
|
145
70
|
else:
|
|
146
|
-
r = versionstr[dash_index + 1
|
|
71
|
+
r = versionstr[dash_index + 1:]
|
|
147
72
|
else:
|
|
148
|
-
tmp = versionstr[colon_index + 1
|
|
149
|
-
if tmp !=
|
|
73
|
+
tmp = versionstr[colon_index + 1:]
|
|
74
|
+
if tmp != '':
|
|
150
75
|
v = tmp
|
|
151
76
|
return (e, v, r)
|
|
152
77
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
# them correctly, they both need to have epochs or not have epochs. However,
|
|
156
|
-
# unlike dnf4 libraries, it they don't take tuples, so use version_tuple to
|
|
157
|
-
# canonicalize the parts of the version, then reassemble them into a full EVR
|
|
158
|
-
# string.
|
|
159
|
-
def version_canonicalize(versionstr):
|
|
160
|
-
e, v, r = version_tuple(versionstr)
|
|
161
|
-
return f"{e}:{v}-{r}"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def versioncompare(command):
|
|
165
|
-
versions = command["versions"]
|
|
166
|
-
sack = get_sack(command)
|
|
78
|
+
def versioncompare(versions):
|
|
79
|
+
sack = get_sack()
|
|
167
80
|
if (versions[0] is None) or (versions[1] is None):
|
|
168
|
-
outpipe.write(
|
|
81
|
+
outpipe.write('0\n')
|
|
169
82
|
outpipe.flush()
|
|
170
83
|
else:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
version_tuple(versions[0]), version_tuple(versions[1])
|
|
174
|
-
)
|
|
175
|
-
outpipe.write("{}\n".format(evr_comparison))
|
|
176
|
-
else:
|
|
177
|
-
# dnf5 version comparison - rpmvercmp handles full EVR strings
|
|
178
|
-
cmp_result = libdnf5.rpm.rpmvercmp(
|
|
179
|
-
version_canonicalize(versions[0]),
|
|
180
|
-
version_canonicalize(versions[1]),
|
|
181
|
-
)
|
|
182
|
-
outpipe.write("{}\n".format(cmp_result))
|
|
84
|
+
evr_comparison = dnf.rpm.rpm.labelCompare(version_tuple(versions[0]), version_tuple(versions[1]))
|
|
85
|
+
outpipe.write('{}\n'.format(evr_comparison))
|
|
183
86
|
outpipe.flush()
|
|
184
87
|
|
|
88
|
+
def query(command):
|
|
89
|
+
sack = get_sack()
|
|
185
90
|
|
|
186
|
-
|
|
187
|
-
sack = get_sack(command)
|
|
188
|
-
|
|
189
|
-
subj = dnf.subject.Subject(command["provides"])
|
|
91
|
+
subj = dnf.subject.Subject(command['provides'])
|
|
190
92
|
q = subj.get_best_query(sack, with_provides=True)
|
|
191
93
|
|
|
192
|
-
if command[
|
|
94
|
+
if command['action'] == "whatinstalled":
|
|
193
95
|
# When attempting to figure out what is installed, we should ignore any
|
|
194
96
|
# excludes that are configured, otherwise the "best" query for a given
|
|
195
97
|
# subject may refer to a package that is installed that provides that
|
|
196
98
|
# subject, but we really want to know if a package by that name exists
|
|
197
99
|
# in any available repository
|
|
198
|
-
q = subj.get_best_query(
|
|
199
|
-
|
|
200
|
-
with_provides=True,
|
|
201
|
-
query=sack.query(flags=hawkey.IGNORE_EXCLUDES),
|
|
202
|
-
)
|
|
100
|
+
q = subj.get_best_query(sack, with_provides=True, query=sack.query(flags=hawkey.IGNORE_EXCLUDES))
|
|
101
|
+
|
|
203
102
|
q = q.installed()
|
|
204
103
|
|
|
205
|
-
if command[
|
|
104
|
+
if command['action'] == "whatavailable":
|
|
206
105
|
q = q.available()
|
|
207
106
|
|
|
208
|
-
if
|
|
107
|
+
if 'epoch' in command:
|
|
209
108
|
# We assume that any glob is "*" so just omit the filter since the dnf libraries have no
|
|
210
109
|
# epoch__glob filter. That means "?" wildcards in epochs will fail. The workaround is to
|
|
211
110
|
# not use the version filter here but to put the version with all the globs in the package name.
|
|
212
|
-
if not dnf.util.is_glob_pattern(command[
|
|
213
|
-
q = q.filterm(epoch=int(command[
|
|
214
|
-
if
|
|
215
|
-
if dnf.util.is_glob_pattern(command[
|
|
216
|
-
q = q.filterm(version__glob=command[
|
|
111
|
+
if not dnf.util.is_glob_pattern(command['epoch']):
|
|
112
|
+
q = q.filterm(epoch=int(command['epoch']))
|
|
113
|
+
if 'version' in command:
|
|
114
|
+
if dnf.util.is_glob_pattern(command['version']):
|
|
115
|
+
q = q.filterm(version__glob=command['version'])
|
|
217
116
|
else:
|
|
218
|
-
q = q.filterm(version=command[
|
|
219
|
-
if
|
|
220
|
-
if dnf.util.is_glob_pattern(command[
|
|
221
|
-
q = q.filterm(release__glob=command[
|
|
117
|
+
q = q.filterm(version=command['version'])
|
|
118
|
+
if 'release' in command:
|
|
119
|
+
if dnf.util.is_glob_pattern(command['release']):
|
|
120
|
+
q = q.filterm(release__glob=command['release'])
|
|
222
121
|
else:
|
|
223
|
-
q = q.filterm(release=command[
|
|
122
|
+
q = q.filterm(release=command['release'])
|
|
224
123
|
|
|
225
|
-
if
|
|
226
|
-
if dnf.util.is_glob_pattern(command[
|
|
227
|
-
q = q.filterm(arch__glob=command[
|
|
124
|
+
if 'arch' in command:
|
|
125
|
+
if dnf.util.is_glob_pattern(command['arch']):
|
|
126
|
+
q = q.filterm(arch__glob=command['arch'])
|
|
228
127
|
else:
|
|
229
|
-
q = q.filterm(arch=command[
|
|
128
|
+
q = q.filterm(arch=command['arch'])
|
|
230
129
|
|
|
231
130
|
# only apply the default arch query filter if it returns something
|
|
232
|
-
archq = q.filter(arch=[
|
|
131
|
+
archq = q.filter(arch=[ 'noarch', hawkey.detect_arch() ])
|
|
233
132
|
if len(archq.run()) > 0:
|
|
234
133
|
q = archq
|
|
235
134
|
|
|
236
135
|
pkgs = q.latest(1).run()
|
|
237
136
|
|
|
238
137
|
if not pkgs:
|
|
239
|
-
outpipe.write(
|
|
138
|
+
outpipe.write('{} nil nil\n'.format(command['provides'].split().pop(0)))
|
|
240
139
|
outpipe.flush()
|
|
241
140
|
else:
|
|
242
141
|
# make sure we picked the package with the highest version
|
|
243
142
|
pkgs.sort
|
|
244
143
|
pkg = pkgs.pop()
|
|
245
|
-
outpipe.write(
|
|
246
|
-
"{} {}:{}-{} {}\n".format(
|
|
247
|
-
pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch
|
|
248
|
-
)
|
|
249
|
-
)
|
|
250
|
-
outpipe.flush()
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
def log(message):
|
|
254
|
-
if DEBUG_FILE is None:
|
|
255
|
-
return
|
|
256
|
-
with open(DEBUG_FILE, "a") as f:
|
|
257
|
-
f.write(message + "\n")
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
def query_dnf5(command):
|
|
261
|
-
"""
|
|
262
|
-
Query dnf5 for package information based on the command dict.
|
|
263
|
-
|
|
264
|
-
This method does a fair amount of work to try to mimic the behavior
|
|
265
|
-
of "dnf install <foo>". In the DNF4 world, this functionality was
|
|
266
|
-
exposed through the dnf.subject.Subject class. In DNF5, this functionality
|
|
267
|
-
is internal to the Goal class, which you can use, but then you can't get
|
|
268
|
-
a list of matching packages out of - you can simply ask the goal to be
|
|
269
|
-
resolved to a package transaction, and then run or not run that transaction.
|
|
270
|
-
|
|
271
|
-
So instead we combine the nevra filtering and provides filtering to mimic
|
|
272
|
-
the behavior of being able to handle anything that could be passed to
|
|
273
|
-
"dnf install <foo>".
|
|
274
|
-
|
|
275
|
-
Some of the cases we handle are:
|
|
276
|
-
- name only: "foo"
|
|
277
|
-
- name and arch: "foo.x86_64"
|
|
278
|
-
- name and version: "foo-1.2"
|
|
279
|
-
- name, version, release: "foo-1.2-3"
|
|
280
|
-
- name, version, release, arch: "foo-1.2-3.x
|
|
281
|
-
- name with version constraint: "foo >= 1.2"
|
|
282
|
-
- globs: "foo*", "foo-1.2*", "foo-1.2-3*", "foo-1*.*", etc.
|
|
283
|
-
|
|
284
|
-
A full exercising of this functionality testing all known cases is
|
|
285
|
-
in the unittest for the DNF provider.
|
|
286
|
-
"""
|
|
287
|
-
base = get_sack(command)
|
|
288
|
-
q = libdnf5.rpm.PackageQuery(base)
|
|
289
|
-
|
|
290
|
-
# First, we need to know if this parses as a nevra or not, which will
|
|
291
|
-
# inform the rest of our decision tree.
|
|
292
|
-
provides_str = command["provides"]
|
|
293
|
-
try:
|
|
294
|
-
nevra_vector = libdnf5.rpm.Nevra.parse(provides_str)
|
|
295
|
-
except libdnf5.exception.RpmNevraIncorrectInputError:
|
|
296
|
-
# when parse() throws an this exception, it's because there's spaces,
|
|
297
|
-
# or other special characters in it, and the only valid things passed
|
|
298
|
-
# to us that fit that category are constrains like: "foo >= 1.2". So
|
|
299
|
-
# parse it as one of those, add the constraint to the query, and update
|
|
300
|
-
# the name we search for to the parsed name
|
|
301
|
-
nevra_vector = []
|
|
302
|
-
reldep = libdnf5.rpm.Reldep(base, provides_str)
|
|
303
|
-
provides_str = reldep.get_name()
|
|
304
|
-
q.filter_provides(reldep)
|
|
305
|
-
|
|
306
|
-
# unlike the old subject based query, filter_nevra doesn't handle
|
|
307
|
-
# the <name>.<arch> case properly. Further, adding * to arch causes
|
|
308
|
-
# weirdness. So, we detect the arch suffix, and strip it off and add
|
|
309
|
-
# it to the direct arch filter.
|
|
310
|
-
#
|
|
311
|
-
# Unfortunately, since we want to support nearly any possible combination
|
|
312
|
-
# of name, version, release, arch with globs, we have to do some extra work
|
|
313
|
-
# here. parse() will give us an iterable list of possible interpretations
|
|
314
|
-
# of the string. That can include dumb things like for "foo-1.2" the
|
|
315
|
-
# possibility that "2" is an arch. So, we take the arch and see if it's
|
|
316
|
-
# a compatible arch with us (e.g. x86_64 and i686 on x86_64 systems). If
|
|
317
|
-
# we find one that matches, we use that, rip the arch off, add it to the
|
|
318
|
-
# filters.
|
|
319
|
-
#
|
|
320
|
-
# While there may be other entries in the list that are (more) correct,
|
|
321
|
-
# it doesn't matter, we're only need to detect if a valid arch was specified
|
|
322
|
-
# so we can handle that manually.
|
|
323
|
-
nevra = None
|
|
324
|
-
for n in nevra_vector:
|
|
325
|
-
log(
|
|
326
|
-
f" => Possible interpretation: n:{n.get_name()} v:{n.get_version()} r:{n.get_release()} a:{n.get_arch()}"
|
|
327
|
-
)
|
|
328
|
-
arch = n.get_arch()
|
|
329
|
-
if arch != "" and rpm.archscore(arch) > 0:
|
|
330
|
-
log(f" => Selected interpretation with arch: {arch}")
|
|
331
|
-
nevra = n
|
|
332
|
-
break
|
|
333
|
-
|
|
334
|
-
# if we found a nevra with a valid arch, use that arch
|
|
335
|
-
if nevra is not None:
|
|
336
|
-
arch = nevra.get_arch()
|
|
337
|
-
name = nevra.get_name()
|
|
338
|
-
if arch and provides_str.endswith(arch):
|
|
339
|
-
command["arch"] = nevra.get_arch()
|
|
340
|
-
# strip of ".<arch>" from the end of provides_str
|
|
341
|
-
provides_str = provides_str[: -(len(arch) + 1)]
|
|
342
|
-
|
|
343
|
-
# in order to get the behavior of "dnf install <blah>" we have to add
|
|
344
|
-
# '*' to the end in order to make stuff like "chef_rpm-1.2" work.
|
|
345
|
-
if not provides_str.endswith("*"):
|
|
346
|
-
provides_str += "*"
|
|
347
|
-
|
|
348
|
-
log(f" => provides_str after processing: {provides_str}")
|
|
349
|
-
log(f" => command after processing: {command}")
|
|
350
|
-
if command["action"] == "whatinstalled":
|
|
351
|
-
q.filter_installed()
|
|
352
|
-
|
|
353
|
-
if command["action"] == "whatavailable":
|
|
354
|
-
q.filter_available()
|
|
355
|
-
|
|
356
|
-
# Apply version filters
|
|
357
|
-
if "epoch" in command:
|
|
358
|
-
if "*" not in command["epoch"] and "?" not in command["epoch"]:
|
|
359
|
-
q.filter_epoch(int(command["epoch"]))
|
|
360
|
-
|
|
361
|
-
if "version" in command:
|
|
362
|
-
if "*" in command["version"] or "?" in command["version"]:
|
|
363
|
-
q.filter_version(command["version"], libdnf5.common.QueryCmp_GLOB)
|
|
364
|
-
else:
|
|
365
|
-
q.filter_version(command["version"])
|
|
366
|
-
|
|
367
|
-
if "release" in command:
|
|
368
|
-
if "*" in command["release"] or "?" in command["release"]:
|
|
369
|
-
q.filter_release(command["release"], libdnf5.common.QueryCmp_GLOB)
|
|
370
|
-
else:
|
|
371
|
-
q.filter_release(command["release"])
|
|
372
|
-
|
|
373
|
-
if "arch" in command:
|
|
374
|
-
if "*" in command["arch"] or "?" in command["arch"]:
|
|
375
|
-
q.filter_arch(command["arch"], libdnf5.common.QueryCmp_GLOB)
|
|
376
|
-
else:
|
|
377
|
-
q.filter_arch(command["arch"])
|
|
378
|
-
|
|
379
|
-
# now, we try by nevra search, and *IF* that returns nothing, then
|
|
380
|
-
# do a provides search. Combined with the work above to handle various
|
|
381
|
-
# name conventions, this gets is roughly compatible with the old
|
|
382
|
-
# dnf4 "subject" calls.
|
|
383
|
-
nevra_q = libdnf5.rpm.PackageQuery(q)
|
|
384
|
-
nevra_q.filter_nevra(provides_str, libdnf5.common.QueryCmp_GLOB)
|
|
385
|
-
if not nevra_q.empty():
|
|
386
|
-
q = nevra_q
|
|
387
|
-
else:
|
|
388
|
-
q.filter_provides(provides_str, libdnf5.common.QueryCmp_GLOB)
|
|
389
|
-
|
|
390
|
-
# Filter by architecture (prefer noarch and native arch)
|
|
391
|
-
# Get the system architecture from vars
|
|
392
|
-
detected_arch = base.get_vars().get_value("arch")
|
|
393
|
-
archq = libdnf5.rpm.PackageQuery(q)
|
|
394
|
-
archq.filter_arch(["noarch", detected_arch])
|
|
395
|
-
|
|
396
|
-
if not archq.empty():
|
|
397
|
-
q = archq
|
|
398
|
-
|
|
399
|
-
# Get latest packages
|
|
400
|
-
q.filter_latest_evr()
|
|
401
|
-
|
|
402
|
-
pkgs = list(q)
|
|
403
|
-
log(f" => pkgs from query: {pkgs}")
|
|
404
|
-
|
|
405
|
-
if not pkgs:
|
|
406
|
-
outpipe.write("{} nil nil\n".format(command["provides"].split().pop(0)))
|
|
144
|
+
outpipe.write('{} {}:{}-{} {}\n'.format(pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch))
|
|
407
145
|
outpipe.flush()
|
|
408
|
-
else:
|
|
409
|
-
# Sort and get the highest version
|
|
410
|
-
pkgs.sort(
|
|
411
|
-
key=lambda p: (p.get_epoch(), p.get_version(), p.get_release()),
|
|
412
|
-
reverse=True,
|
|
413
|
-
)
|
|
414
|
-
pkg = pkgs[0]
|
|
415
|
-
outpipe.write(
|
|
416
|
-
"{} {}:{}-{} {}\n".format(
|
|
417
|
-
pkg.get_name(),
|
|
418
|
-
pkg.get_epoch(),
|
|
419
|
-
pkg.get_version(),
|
|
420
|
-
pkg.get_release(),
|
|
421
|
-
pkg.get_arch(),
|
|
422
|
-
)
|
|
423
|
-
)
|
|
424
|
-
outpipe.flush()
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
def query(command):
|
|
428
|
-
if DNF_VERSION == 5:
|
|
429
|
-
query_dnf5(command)
|
|
430
|
-
else:
|
|
431
|
-
query_dnf4(command)
|
|
432
|
-
|
|
433
146
|
|
|
434
147
|
# the design of this helper is that it should try to be 'brittle' and fail hard and exit in order
|
|
435
148
|
# to keep process tables clean. additional error handling should probably be added to the retry loop
|
|
436
149
|
# on the ruby side.
|
|
437
150
|
def exit_handler(signal, frame):
|
|
438
|
-
if
|
|
151
|
+
if base is not None:
|
|
439
152
|
base.close()
|
|
440
153
|
sys.exit(0)
|
|
441
154
|
|
|
442
|
-
|
|
443
155
|
def setup_exit_handler():
|
|
444
156
|
signal.signal(signal.SIGINT, exit_handler)
|
|
445
157
|
signal.signal(signal.SIGHUP, exit_handler)
|
|
446
158
|
signal.signal(signal.SIGPIPE, exit_handler)
|
|
447
159
|
signal.signal(signal.SIGQUIT, exit_handler)
|
|
448
160
|
|
|
449
|
-
|
|
450
161
|
if len(sys.argv) < 3:
|
|
451
162
|
inpipe = sys.stdin
|
|
452
163
|
outpipe = sys.stdout
|
|
@@ -474,15 +185,14 @@ try:
|
|
|
474
185
|
except ValueError:
|
|
475
186
|
raise RuntimeError("bad json parse")
|
|
476
187
|
|
|
477
|
-
|
|
478
|
-
if command["action"] == "whatinstalled":
|
|
188
|
+
if command['action'] == "whatinstalled":
|
|
479
189
|
query(command)
|
|
480
|
-
elif command[
|
|
190
|
+
elif command['action'] == "whatavailable":
|
|
481
191
|
query(command)
|
|
482
|
-
elif command[
|
|
483
|
-
versioncompare(command)
|
|
192
|
+
elif command['action'] == "versioncompare":
|
|
193
|
+
versioncompare(command['versions'])
|
|
484
194
|
else:
|
|
485
195
|
raise RuntimeError("bad command")
|
|
486
196
|
finally:
|
|
487
|
-
if
|
|
197
|
+
if base is not None:
|
|
488
198
|
base.close()
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
1
|
#
|
|
3
2
|
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
|
-
# Copyright:: Copyright (c) 2026 Meta Platforms, Inc.
|
|
5
|
-
# Copyright:: Copyright (c) 2026 Phil Dibowitz
|
|
6
3
|
# License:: Apache License, Version 2.0
|
|
7
4
|
#
|
|
8
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -44,10 +41,10 @@ class Chef
|
|
|
44
41
|
|
|
45
42
|
def dnf_command
|
|
46
43
|
# platform-python is used for system tools on RHEL 8 and is installed under /usr/libexec
|
|
47
|
-
py_cmd = "try:\n import libdnf5\nexcept ImportError:\n import dnf"
|
|
48
44
|
@dnf_command ||= begin
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
|
|
46
|
+
shell_out("#{f} -c 'import dnf'").exitstatus == 0
|
|
47
|
+
end
|
|
51
48
|
raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd
|
|
52
49
|
|
|
53
50
|
"#{cmd} #{DNF_HELPER}"
|
|
@@ -148,8 +145,8 @@ class Chef
|
|
|
148
145
|
end
|
|
149
146
|
|
|
150
147
|
def query(action, parameters)
|
|
148
|
+
json = build_query(action, parameters)
|
|
151
149
|
with_helper do
|
|
152
|
-
json = build_query(action, parameters)
|
|
153
150
|
Chef::Log.trace "sending '#{json}' to python helper"
|
|
154
151
|
outpipe.puts json
|
|
155
152
|
outpipe.flush
|
|
@@ -214,7 +211,7 @@ class Chef
|
|
|
214
211
|
else
|
|
215
212
|
raise e if output.empty?
|
|
216
213
|
|
|
217
|
-
raise "
|
|
214
|
+
raise "dnf_helper.py had stderr/stdout output:\n\n#{output}"
|
|
218
215
|
end
|
|
219
216
|
end
|
|
220
217
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
|
-
# Copyright:: Copyright (c) 2026 Meta Platforms, Inc.
|
|
4
|
-
# Copyright:: Copyright (c) 2026 Phil Dibowitz
|
|
5
3
|
# License:: Apache License, Version 2.0
|
|
6
4
|
#
|
|
7
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -64,13 +62,6 @@ class Chef
|
|
|
64
62
|
@python_helper ||= PythonHelper.instance
|
|
65
63
|
end
|
|
66
64
|
|
|
67
|
-
def dnf5?
|
|
68
|
-
@dnf5 ||= begin
|
|
69
|
-
dnf_version = shell_out!("dnf --version").stdout
|
|
70
|
-
dnf_version =~ /dnf5/i
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
65
|
def load_current_resource
|
|
75
66
|
flushcache if new_resource.flush_cache[:before]
|
|
76
67
|
|
|
@@ -147,19 +138,14 @@ class Chef
|
|
|
147
138
|
# NB: the dnf_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard
|
|
148
139
|
# support to lock / unlock. The best solution is to write an execute resource which does a not_if `dnf versionlock | grep '^pattern`` kind of approach
|
|
149
140
|
def lock_package(names, versions)
|
|
150
|
-
|
|
151
|
-
dnf(default_opts, options, "versionlock", "add", resolved_package_lock_names(names))
|
|
141
|
+
dnf("-d0", "-e0", "-y", options, "versionlock", "add", resolved_package_lock_names(names))
|
|
152
142
|
end
|
|
153
143
|
|
|
154
144
|
# NB: the dnf_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard
|
|
155
145
|
# support to lock / unlock. The best solution is to write an execute resource which does a only_if `dnf versionlock | grep '^pattern`` kind of approach
|
|
156
146
|
def unlock_package(names, versions)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
else
|
|
160
|
-
# dnf versionlock delete on rhel6 needs the glob nonsense in the following command
|
|
161
|
-
dnf("-d0", "-e0", "-y", options, "versionlock", "delete", resolved_package_lock_names(names).map { |n| "*:#{n}-*" })
|
|
162
|
-
end
|
|
147
|
+
# dnf versionlock delete on rhel6 needs the glob nonsense in the following command
|
|
148
|
+
dnf("-d0", "-e0", "-y", options, "versionlock", "delete", resolved_package_lock_names(names).map { |n| "*:#{n}-*" })
|
|
163
149
|
end
|
|
164
150
|
|
|
165
151
|
private
|
|
@@ -181,13 +167,8 @@ class Chef
|
|
|
181
167
|
@locked_packages ||=
|
|
182
168
|
begin
|
|
183
169
|
locked = dnf("versionlock", "list")
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
.map { |line| line.split(": ").last.strip }
|
|
187
|
-
else
|
|
188
|
-
locked.stdout.each_line.map do |line|
|
|
189
|
-
line.sub(/-[^-]*-[^-]*$/, "").split(":").last.strip
|
|
190
|
-
end
|
|
170
|
+
locked.stdout.each_line.map do |line|
|
|
171
|
+
line.sub(/-[^-]*-[^-]*$/, "").split(":").last.strip
|
|
191
172
|
end
|
|
192
173
|
end
|
|
193
174
|
end
|
|
@@ -25,11 +25,11 @@ class Chef
|
|
|
25
25
|
class Package
|
|
26
26
|
class Dpkg < Chef::Provider::Package
|
|
27
27
|
include Chef::Provider::Package::Deb
|
|
28
|
-
DPKG_REMOVED = /^Status: deinstall ok config-files
|
|
29
|
-
DPKG_INSTALLED = /^Status: install ok installed
|
|
30
|
-
DPKG_VERSION = /^Version: (.+)
|
|
28
|
+
DPKG_REMOVED = /^Status: deinstall ok config-files/
|
|
29
|
+
DPKG_INSTALLED = /^Status: install ok installed/
|
|
30
|
+
DPKG_VERSION = /^Version: (.+)$/
|
|
31
31
|
|
|
32
|
-
provides :dpkg_package
|
|
32
|
+
provides :dpkg_package, target_mode: true
|
|
33
33
|
|
|
34
34
|
use_multipackage_api
|
|
35
35
|
use_package_name_for_source
|
|
@@ -146,14 +146,14 @@ class Chef
|
|
|
146
146
|
#
|
|
147
147
|
# @return [Boolean] True if all sources exist
|
|
148
148
|
def source_files_exist?
|
|
149
|
-
resolved_source_array.all? { |s| s && ::File.exist?(s) }
|
|
149
|
+
resolved_source_array.all? { |s| s && ::TargetIO::File.exist?(s) }
|
|
150
150
|
end
|
|
151
151
|
|
|
152
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
|
|
156
|
-
resolved_source_array.select { |s| s.nil? || !::File.exist?(s) }
|
|
156
|
+
resolved_source_array.select { |s| s.nil? || !::TargetIO::File.exist?(s) }
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
def current_package_name_array
|