chef 13.12.14-universal-mingw32 → 14.0.190-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +151 -0
- data/Gemfile +12 -9
- data/README.md +34 -32
- data/Rakefile +22 -18
- data/VERSION +1 -0
- data/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml +33 -0
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +272 -0
- data/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml +57 -0
- data/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +68 -0
- data/acceptance/.shared/kitchen_acceptance/metadata.rb +1 -0
- data/acceptance/Gemfile +19 -0
- data/acceptance/Gemfile.lock +266 -0
- data/acceptance/README.md +137 -0
- data/acceptance/basics/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/basics/.acceptance/acceptance-cookbook/metadata.rb +3 -0
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -0
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -0
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -0
- data/acceptance/basics/.kitchen.yml +4 -0
- data/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb +19 -0
- data/acceptance/basics/test/integration/chef-current-install/serverspec/spec_helper.rb +6 -0
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/metadata.rb +3 -0
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/destroy.rb +2 -0
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/provision.rb +2 -0
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/verify.rb +2 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/.gitignore +16 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/Berksfile +3 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb +101 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/apigemfile +3 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-both-mode.rb +4 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-client-mode.rb +4 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-no-endpoint.rb +2 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-solo-mode.rb +4 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/config.ru +2 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/metadata.rb +7 -0
- data/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb +44 -0
- data/acceptance/data-collector/.kitchen.yml +9 -0
- data/acceptance/data-collector/Berksfile +3 -0
- data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +208 -0
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb +1 -0
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -0
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -0
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb +61 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb +43 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +41 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb +3 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -0
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -0
- data/acceptance/top-cookbooks/.gitignore +1 -0
- data/acceptance/top-cookbooks/.kitchen.chocolatey.yml +6 -0
- data/acceptance/top-cookbooks/.kitchen.iis.yml +4 -0
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml +7 -0
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml +7 -0
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-windows.yml +7 -0
- data/acceptance/top-cookbooks/.kitchen.powershell.yml +4 -0
- data/acceptance/top-cookbooks/.kitchen.sql_server.yml +5 -0
- data/acceptance/top-cookbooks/.kitchen.winbox.yml +8 -0
- data/acceptance/top-cookbooks/.kitchen.windows.yml +38 -0
- data/acceptance/trivial/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/trivial/.acceptance/acceptance-cookbook/metadata.rb +2 -0
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -0
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -0
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -0
- data/acceptance/trivial/.kitchen.yml +7 -0
- data/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb +5 -0
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/.gitignore +2 -0
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb +2 -0
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb +1 -0
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -0
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb +1 -0
- data/acceptance/windows-service/.kitchen.yml +7 -0
- data/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb +58 -0
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +10 -10
- data/distro/powershell/chef/Chef.PowerShell.dll +0 -0
- data/distro/powershell/chef/Newtonsoft.Json.dll +0 -0
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/api_client/registration.rb +10 -2
- data/lib/chef/api_client_v1.rb +7 -6
- data/lib/chef/application.rb +75 -46
- data/lib/chef/application/client.rb +17 -19
- data/lib/chef/application/solo.rb +13 -16
- data/lib/chef/application/windows_service.rb +5 -5
- data/lib/chef/audit/audit_event_proxy.rb +1 -1
- data/lib/chef/audit/audit_reporter.rb +12 -12
- data/lib/chef/audit/runner.rb +2 -2
- data/lib/chef/chef_fs/chef_fs_data_store.rb +17 -31
- data/lib/chef/chef_fs/command_line.rb +9 -9
- data/lib/chef/chef_fs/data_handler/acl_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/policy_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/policy_group_data_handler.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/policies_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +2 -2
- data/lib/chef/chef_fs/file_system_cache.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +2 -2
- data/lib/chef/client.rb +61 -41
- data/lib/chef/config.rb +1 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/chefignore.rb +2 -2
- data/lib/chef/cookbook/cookbook_collection.rb +2 -2
- data/lib/chef/cookbook/cookbook_version_loader.rb +0 -1
- data/lib/chef/cookbook/gem_installer.rb +4 -4
- data/lib/chef/cookbook/manifest_v2.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +2 -3
- data/lib/chef/cookbook/remote_file_vendor.rb +4 -4
- data/lib/chef/cookbook/synchronizer.rb +2 -2
- data/lib/chef/cookbook/syntax_check.rb +4 -4
- data/lib/chef/cookbook_loader.rb +10 -2
- data/lib/chef/cookbook_site_streaming_uploader.rb +4 -4
- data/lib/chef/cookbook_uploader.rb +2 -3
- data/lib/chef/cookbook_version.rb +5 -11
- data/lib/chef/data_bag.rb +1 -3
- data/lib/chef/data_bag_item.rb +1 -7
- data/lib/chef/data_collector.rb +111 -35
- data/lib/chef/data_collector/messages.rb +2 -2
- data/lib/chef/data_collector/messages/helpers.rb +2 -4
- data/lib/chef/deprecated.rb +0 -4
- data/lib/chef/dsl/data_query.rb +1 -5
- data/lib/chef/dsl/include_attribute.rb +3 -7
- data/lib/chef/dsl/include_recipe.rb +1 -5
- data/lib/chef/dsl/platform_introspection.rb +9 -13
- data/lib/chef/dsl/reboot_pending.rb +1 -8
- data/lib/chef/dsl/recipe.rb +2 -12
- data/lib/chef/dsl/universal.rb +3 -3
- data/lib/chef/environment.rb +2 -4
- data/lib/chef/event_dispatch/dsl.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_content_management/content_base.rb +3 -1
- data/lib/chef/file_content_management/deploy/cp.rb +2 -2
- data/lib/chef/file_content_management/deploy/mv_unix.rb +4 -4
- data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +3 -3
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +3 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +2 -2
- data/lib/chef/handler.rb +1 -3
- data/lib/chef/handler/json_file.rb +1 -2
- data/lib/chef/http.rb +23 -11
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/basic_client.rb +16 -17
- data/lib/chef/http/decompressor.rb +6 -6
- data/lib/chef/http/http_request.rb +5 -5
- data/lib/chef/http/json_output.rb +2 -2
- data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
- data/lib/chef/http/validate_content_length.rb +5 -5
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +12 -37
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +7 -1
- data/lib/chef/knife/client_reregister.rb +1 -1
- data/lib/chef/knife/configure.rb +1 -3
- data/lib/chef/knife/cookbook_download.rb +2 -2
- data/lib/chef/knife/cookbook_metadata.rb +3 -3
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/cookbook_site_share.rb +5 -5
- data/lib/chef/knife/cookbook_test.rb +2 -2
- data/lib/chef/knife/cookbook_upload.rb +2 -2
- data/lib/chef/knife/core/status_presenter.rb +22 -17
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/deps.rb +1 -1
- data/lib/chef/knife/environment_compare.rb +4 -4
- data/lib/chef/knife/exec.rb +3 -3
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/node_policy_set.rb +79 -0
- data/lib/chef/knife/osc_user_reregister.rb +1 -1
- data/lib/chef/knife/ssh.rb +35 -22
- data/lib/chef/knife/ssl_check.rb +3 -3
- data/lib/chef/knife/ssl_fetch.rb +1 -1
- data/lib/chef/knife/user_reregister.rb +1 -1
- data/lib/chef/knife/xargs.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +2 -4
- data/lib/chef/mixin/create_path.rb +1 -1
- data/lib/chef/mixin/deprecation.rb +14 -14
- data/lib/chef/mixin/from_file.rb +5 -0
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/homebrew_user.rb +13 -2
- data/lib/chef/mixin/openssl_helper.rb +119 -0
- data/lib/chef/mixin/params_validate.rb +2 -8
- data/lib/chef/mixin/powershell_exec.rb +105 -0
- data/lib/chef/mixin/provides.rb +3 -2
- data/lib/chef/mixin/securable.rb +1 -5
- data/lib/chef/mixin/shell_out.rb +2 -2
- data/lib/chef/mixin/template.rb +1 -3
- data/lib/chef/mixin/user_context.rb +6 -3
- data/lib/chef/mixin/why_run.rb +6 -11
- data/lib/chef/monkey_patches/net_http.rb +7 -7
- data/lib/chef/monologger.rb +2 -86
- data/lib/chef/node.rb +30 -20
- data/lib/chef/node/attribute.rb +1 -6
- data/lib/chef/node/attribute_collections.rb +2 -2
- data/lib/chef/node/immutable_collections.rb +1 -1
- data/lib/chef/node/mixin/immutablize_array.rb +110 -3
- data/lib/chef/node/mixin/immutablize_hash.rb +111 -5
- data/lib/chef/node_map.rb +5 -23
- data/lib/chef/platform/query_helpers.rb +0 -12
- 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 +17 -1
- data/lib/chef/powershell.rb +55 -0
- data/lib/chef/property.rb +12 -34
- data/lib/chef/provider.rb +16 -39
- data/lib/chef/provider/apt_preference.rb +3 -3
- data/lib/chef/provider/apt_repository.rb +116 -34
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/cookbook_file/content.rb +1 -1
- data/lib/chef/provider/cron.rb +10 -10
- data/lib/chef/provider/cron/unix.rb +3 -3
- data/lib/chef/provider/directory.rb +3 -3
- data/lib/chef/provider/dsc_resource.rb +4 -4
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/execute.rb +9 -5
- data/lib/chef/provider/file.rb +12 -12
- data/lib/chef/provider/git.rb +14 -14
- data/lib/chef/provider/group.rb +6 -6
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +4 -4
- data/lib/chef/provider/group/groupadd.rb +4 -4
- data/lib/chef/provider/group/groupmod.rb +3 -3
- data/lib/chef/provider/group/pw.rb +4 -4
- data/lib/chef/provider/group/windows.rb +2 -2
- data/lib/chef/provider/http_request.rb +12 -12
- data/lib/chef/provider/ifconfig.rb +6 -6
- data/lib/chef/provider/ifconfig/aix.rb +1 -1
- data/lib/chef/provider/ifconfig/debian.rb +3 -5
- data/lib/chef/provider/launchd.rb +1 -1
- data/lib/chef/provider/link.rb +6 -6
- data/lib/chef/provider/log.rb +1 -1
- data/lib/chef/provider/lwrp_base.rb +2 -2
- data/lib/chef/provider/mdadm.rb +10 -10
- data/lib/chef/provider/mount.rb +12 -12
- data/lib/chef/provider/mount/aix.rb +20 -21
- data/lib/chef/provider/mount/mount.rb +20 -15
- data/lib/chef/provider/mount/solaris.rb +6 -6
- data/lib/chef/provider/mount/windows.rb +7 -7
- data/lib/chef/provider/noop.rb +1 -1
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +8 -8
- data/lib/chef/provider/package.rb +56 -42
- data/lib/chef/provider/package/apt.rb +24 -14
- data/lib/chef/provider/package/{aix.rb → bff.rb} +12 -12
- data/lib/chef/provider/package/cab.rb +3 -3
- data/lib/chef/provider/package/chocolatey.rb +1 -9
- data/lib/chef/provider/package/dnf/python_helper.rb +6 -6
- data/lib/chef/provider/package/dpkg.rb +9 -9
- data/lib/chef/provider/package/freebsd/base.rb +2 -2
- data/lib/chef/provider/package/freebsd/pkg.rb +2 -2
- data/lib/chef/provider/package/freebsd/pkgng.rb +1 -1
- data/lib/chef/provider/package/homebrew.rb +3 -3
- data/lib/chef/provider/package/ips.rb +2 -2
- data/lib/chef/provider/package/macports.rb +3 -3
- data/lib/chef/provider/package/msu.rb +2 -2
- data/lib/chef/provider/package/openbsd.rb +3 -3
- data/lib/chef/provider/package/pacman.rb +3 -3
- data/lib/chef/provider/package/paludis.rb +2 -2
- data/lib/chef/provider/package/portage.rb +27 -33
- data/lib/chef/provider/package/powershell.rb +24 -9
- data/lib/chef/provider/package/rpm.rb +5 -6
- data/lib/chef/provider/package/rubygems.rb +32 -28
- data/lib/chef/provider/package/smartos.rb +6 -6
- data/lib/chef/provider/package/solaris.rb +10 -10
- data/lib/chef/provider/package/windows.rb +6 -15
- data/lib/chef/provider/package/windows/exe.rb +6 -4
- data/lib/chef/provider/package/windows/msi.rb +8 -6
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +12 -6
- data/lib/chef/provider/package/yum.rb +167 -398
- data/lib/chef/provider/package/yum/python_helper.rb +221 -0
- data/lib/chef/provider/package/yum/rpm_utils.rb +10 -1
- data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +79 -0
- data/lib/chef/provider/package/yum/simplejson/__init__.py +318 -0
- data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.py +354 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.py +440 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.py +65 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/tool.py +37 -0
- data/lib/chef/provider/package/yum/version.rb +56 -0
- data/lib/chef/provider/package/yum/yum_cache.rb +33 -316
- data/lib/chef/provider/package/yum/yum_helper.py +198 -0
- data/lib/chef/provider/package/zypper.rb +9 -13
- data/lib/chef/provider/powershell_script.rb +3 -3
- data/lib/chef/provider/reboot.rb +3 -3
- data/lib/chef/provider/registry_key.rb +16 -4
- data/lib/chef/provider/remote_directory.rb +1 -3
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
- data/lib/chef/provider/remote_file/content.rb +4 -4
- data/lib/chef/provider/remote_file/http.rb +5 -3
- data/lib/chef/provider/remote_file/local_file.rb +1 -1
- data/lib/chef/provider/remote_file/network_file.rb +2 -2
- data/lib/chef/provider/route.rb +12 -11
- data/lib/chef/provider/ruby_block.rb +1 -1
- data/lib/chef/provider/script.rb +2 -2
- data/lib/chef/provider/service.rb +14 -14
- data/lib/chef/provider/service/aix.rb +3 -3
- data/lib/chef/provider/service/aixinit.rb +2 -2
- data/lib/chef/provider/service/debian.rb +5 -5
- data/lib/chef/provider/service/freebsd.rb +3 -3
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +8 -8
- data/lib/chef/provider/service/openbsd.rb +1 -1
- data/lib/chef/provider/service/simple.rb +7 -7
- data/lib/chef/provider/service/systemd.rb +4 -4
- data/lib/chef/provider/service/upstart.rb +10 -9
- data/lib/chef/provider/service/windows.rb +245 -70
- data/lib/chef/provider/subversion.rb +8 -8
- data/lib/chef/provider/systemd_unit.rb +25 -6
- data/lib/chef/provider/user.rb +10 -10
- data/lib/chef/provider/user/aix.rb +3 -3
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/pw.rb +4 -4
- data/lib/chef/provider/user/solaris.rb +1 -1
- data/lib/chef/provider/user/useradd.rb +3 -3
- data/lib/chef/provider/user/windows.rb +4 -4
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
- data/lib/chef/provider/{env.rb → windows_env.rb} +55 -19
- data/lib/chef/provider/windows_task.rb +27 -27
- data/lib/chef/provider/zypper_repository.rb +7 -7
- data/lib/chef/provider_resolver.rb +4 -4
- data/lib/chef/providers.rb +2 -9
- data/lib/chef/resource.rb +19 -13
- data/lib/chef/resource/action_class.rb +2 -2
- data/lib/chef/resource/apt_package.rb +10 -4
- data/lib/chef/resource/apt_preference.rb +20 -7
- data/lib/chef/resource/apt_repository.rb +21 -12
- data/lib/chef/resource/apt_update.rb +3 -3
- data/lib/chef/resource/bash.rb +6 -4
- data/lib/chef/resource/batch.rb +8 -6
- data/lib/chef/resource/bff_package.rb +8 -5
- data/lib/chef/resource/breakpoint.rb +9 -6
- data/lib/chef/resource/build_essential.rb +139 -0
- data/lib/chef/resource/cab_package.rb +5 -4
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/chef_handler.rb +130 -0
- data/lib/chef/resource/chocolatey_package.rb +6 -6
- data/lib/chef/resource/cookbook_file.rb +12 -9
- data/lib/chef/resource/cron.rb +14 -75
- data/lib/chef/resource/csh.rb +6 -4
- data/lib/chef/resource/directory.rb +7 -4
- data/lib/chef/resource/dmg_package.rb +161 -0
- data/lib/chef/resource/dnf_package.rb +10 -7
- data/lib/chef/resource/dpkg_package.rb +5 -3
- data/lib/chef/resource/dsc_resource.rb +11 -28
- data/lib/chef/resource/dsc_script.rb +14 -37
- data/lib/chef/resource/execute.rb +15 -78
- data/lib/chef/resource/file.rb +6 -5
- data/lib/chef/resource/file/verification.rb +5 -1
- data/lib/chef/resource/freebsd_package.rb +2 -1
- data/lib/chef/resource/gem_package.rb +6 -3
- data/lib/chef/resource/git.rb +4 -15
- data/lib/chef/resource/group.rb +7 -46
- data/lib/chef/resource/homebrew_cask.rb +98 -0
- data/lib/chef/resource/homebrew_package.rb +3 -3
- data/lib/chef/resource/homebrew_tap.rb +86 -0
- data/lib/chef/resource/hostname.rb +249 -0
- data/lib/chef/resource/http_request.rb +8 -22
- data/lib/chef/resource/ifconfig.rb +3 -2
- data/lib/chef/resource/ips_package.rb +4 -3
- data/lib/chef/resource/ksh.rb +7 -6
- data/lib/chef/resource/launchd.rb +4 -4
- data/lib/chef/resource/link.rb +18 -56
- data/lib/chef/resource/log.rb +6 -8
- data/lib/chef/resource/lwrp_base.rb +4 -5
- data/lib/chef/resource/macos_userdefaults.rb +133 -0
- data/lib/chef/resource/macosx_service.rb +7 -23
- data/lib/chef/resource/macports_package.rb +2 -1
- data/lib/chef/resource/mdadm.rb +13 -84
- data/lib/chef/resource/mount.rb +21 -127
- data/lib/chef/resource/msu_package.rb +4 -4
- data/lib/chef/resource/ohai.rb +5 -3
- data/lib/chef/resource/ohai_hint.rb +93 -0
- data/lib/chef/resource/openbsd_package.rb +3 -3
- data/lib/chef/resource/openssl_dhparam.rb +80 -0
- data/lib/chef/resource/openssl_rsa_private_key.rb +93 -0
- data/lib/chef/resource/openssl_rsa_public_key.rb +73 -0
- data/lib/chef/resource/osx_profile.rb +9 -10
- data/lib/chef/resource/package.rb +8 -6
- data/lib/chef/resource/pacman_package.rb +3 -2
- data/lib/chef/resource/paludis_package.rb +4 -4
- data/lib/chef/resource/perl.rb +6 -4
- data/lib/chef/resource/portage_package.rb +3 -6
- data/lib/chef/resource/powershell_package.rb +9 -13
- data/lib/chef/resource/powershell_script.rb +9 -8
- data/lib/chef/resource/python.rb +5 -4
- data/lib/chef/resource/reboot.rb +8 -9
- data/lib/chef/resource/registry_key.rb +9 -19
- data/lib/chef/resource/remote_directory.rb +5 -3
- data/lib/chef/resource/remote_file.rb +11 -50
- data/lib/chef/resource/resource_notification.rb +2 -2
- data/lib/chef/resource/rhsm_errata.rb +44 -0
- data/lib/chef/resource/rhsm_errata_level.rb +51 -0
- data/lib/chef/resource/rhsm_register.rb +162 -0
- data/lib/chef/resource/rhsm_repo.rb +62 -0
- data/lib/chef/resource/rhsm_subscription.rb +95 -0
- data/lib/chef/resource/route.rb +3 -1
- data/lib/chef/resource/rpm_package.rb +3 -3
- data/lib/chef/resource/ruby.rb +6 -4
- data/lib/chef/resource/ruby_block.rb +6 -17
- data/lib/chef/resource/scm.rb +14 -146
- data/lib/chef/resource/script.rb +7 -5
- data/lib/chef/resource/service.rb +2 -1
- data/lib/chef/resource/smartos_package.rb +4 -3
- data/lib/chef/resource/solaris_package.rb +3 -2
- data/lib/chef/resource/subversion.rb +20 -4
- data/lib/chef/resource/sudo.rb +231 -0
- data/lib/chef/resource/support/sudoer.erb +18 -0
- data/lib/chef/resource/swap_file.rb +209 -0
- data/lib/chef/resource/sysctl.rb +111 -0
- data/lib/chef/resource/systemd_unit.rb +6 -5
- data/lib/chef/resource/template.rb +6 -27
- data/lib/chef/resource/windows_ad_join.rb +92 -0
- data/lib/chef/resource/windows_auto_run.rb +87 -0
- data/lib/chef/resource/{env.rb → windows_env.rb} +11 -5
- data/lib/chef/resource/windows_feature.rb +95 -0
- data/lib/chef/resource/windows_feature_dism.rb +226 -0
- data/lib/chef/resource/windows_feature_powershell.rb +256 -0
- data/lib/chef/resource/windows_font.rb +127 -0
- data/lib/chef/resource/windows_package.rb +5 -3
- data/lib/chef/resource/windows_pagefile.rb +206 -0
- data/lib/chef/resource/windows_path.rb +3 -3
- data/lib/chef/resource/windows_printer.rb +148 -0
- data/lib/chef/resource/windows_printer_port.rb +136 -0
- data/lib/chef/resource/windows_service.rb +79 -38
- data/lib/chef/resource/windows_shortcut.rb +79 -0
- data/lib/chef/resource/windows_task.rb +5 -5
- data/lib/chef/resource/yum_package.rb +8 -2
- data/lib/chef/resource/yum_repository.rb +12 -5
- data/lib/chef/resource/zypper_package.rb +5 -3
- data/lib/chef/resource/zypper_repository.rb +17 -12
- data/lib/chef/resource_inspector.rb +89 -0
- data/lib/chef/resource_reporter.rb +5 -6
- data/lib/chef/resource_resolver.rb +4 -4
- data/lib/chef/resources.rb +31 -6
- data/lib/chef/role.rb +1 -3
- data/lib/chef/run_context.rb +21 -12
- data/lib/chef/run_context/cookbook_compiler.rb +18 -9
- data/lib/chef/search/query.rb +1 -2
- data/lib/chef/shell.rb +0 -1
- data/lib/chef/shell/model_wrapper.rb +1 -1
- data/lib/chef/shell/shell_session.rb +4 -3
- data/lib/chef/util/diff.rb +2 -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 +4 -4
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/logon_session.rb +5 -2
- data/lib/chef/util/windows/net_user.rb +2 -2
- data/lib/chef/util/windows/volume.rb +0 -4
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/api/security.rb +11 -0
- data/lib/chef/win32/eventlog.rb +2 -2
- data/lib/chef/win32/mutex.rb +1 -1
- data/lib/chef/win32/registry.rb +17 -17
- data/lib/chef/win32/security.rb +34 -12
- data/lib/chef/win32/security/sid.rb +1 -2
- data/lib/chef/win32/version.rb +2 -15
- data/lib/chef/win32_service_constants.rb +143 -0
- data/spec/data/mixin/invalid_data.rb +3 -0
- data/spec/data/mixin/real_data.rb +2 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.aarch64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.ppc64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.s390x.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.aarch64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.ppc64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.s390x.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/repodata/4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/repomd.xml +19 -53
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +2 -2
- data/spec/functional/http/simple_spec.rb +6 -6
- data/spec/functional/mixin/from_file_spec.rb +82 -0
- data/spec/functional/notifications_spec.rb +1 -1
- data/spec/functional/resource/{package_spec.rb → apt_package_spec.rb} +4 -4
- data/spec/functional/resource/dnf_package_spec.rb +115 -115
- data/spec/functional/resource/ifconfig_spec.rb +1 -2
- data/spec/functional/resource/link_spec.rb +9 -13
- data/spec/functional/resource/powershell_script_spec.rb +0 -2
- data/spec/functional/resource/registry_spec.rb +3 -3
- data/spec/functional/resource/remote_file_spec.rb +4 -4
- data/spec/functional/resource/user/windows_spec.rb +3 -1
- data/spec/functional/resource/windows_env_spec.rb +285 -0
- data/spec/functional/resource/windows_task_spec.rb +303 -2
- data/spec/functional/resource/yum_package_spec.rb +949 -0
- data/spec/functional/root_alias_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +60 -7
- data/spec/functional/win32/versions_spec.rb +7 -9
- data/spec/integration/client/client_spec.rb +99 -7
- data/spec/integration/knife/chef_fs_data_store_spec.rb +23 -4
- data/spec/integration/recipes/recipe_dsl_spec.rb +26 -26
- data/spec/integration/recipes/resource_action_spec.rb +25 -120
- data/spec/spec_helper.rb +10 -2
- data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -2
- data/spec/support/lib/chef/resource/zen_master.rb +1 -3
- data/spec/support/mock/constant.rb +1 -1
- data/spec/support/platform_helpers.rb +24 -7
- data/spec/support/shared/context/client.rb +13 -10
- data/spec/support/shared/examples/client.rb +50 -0
- data/spec/support/shared/functional/file_resource.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +2 -2
- data/spec/support/shared/integration/knife_support.rb +5 -0
- data/spec/unit/application/client_spec.rb +39 -13
- data/spec/unit/application/solo_spec.rb +1 -8
- data/spec/unit/application_spec.rb +66 -2
- data/spec/unit/audit/audit_event_proxy_spec.rb +1 -1
- data/spec/unit/audit/audit_reporter_spec.rb +16 -16
- data/spec/unit/chef_fs/file_system_spec.rb +1 -1
- data/spec/unit/client_spec.rb +3 -4
- data/spec/unit/cookbook/metadata_spec.rb +1 -1
- data/spec/unit/cookbook_loader_spec.rb +6 -6
- data/spec/unit/cookbook_manifest_spec.rb +2 -2
- data/spec/unit/cookbook_version_file_specificity_spec.rb +5 -25
- data/spec/unit/data_collector/messages/helpers_spec.rb +9 -0
- data/spec/unit/data_collector/resource_report_spec.rb +3 -3
- data/spec/unit/data_collector_spec.rb +135 -1
- data/spec/unit/dsl/reboot_pending_spec.rb +0 -13
- data/spec/unit/dsl/recipe_spec.rb +0 -13
- data/spec/unit/environment_spec.rb +2 -2
- data/spec/unit/exceptions_spec.rb +1 -1
- data/spec/unit/http/validate_content_length_spec.rb +5 -5
- data/spec/unit/knife/bootstrap_spec.rb +11 -15
- data/spec/unit/knife/configure_spec.rb +1 -2
- data/spec/unit/knife/cookbook_test_spec.rb +2 -2
- data/spec/unit/knife/core/gem_glob_loader_spec.rb +2 -2
- data/spec/unit/knife/core/node_editor_spec.rb +6 -6
- data/spec/unit/knife/environment_compare_spec.rb +3 -3
- data/spec/unit/knife/node_edit_spec.rb +3 -1
- data/spec/unit/knife/node_policy_set_spec.rb +122 -0
- data/spec/unit/knife/osc_user_reregister_spec.rb +1 -1
- data/spec/unit/knife/osc_user_show_spec.rb +1 -1
- data/spec/unit/knife/ssh_spec.rb +18 -0
- data/spec/unit/log/syslog_spec.rb +2 -4
- data/spec/unit/log/winevt_spec.rb +2 -3
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mixin/homebrew_user_spec.rb +1 -5
- data/spec/unit/mixin/openssl_helper_spec.rb +252 -0
- data/spec/unit/mixin/powershell_exec_spec.rb +43 -0
- data/spec/unit/node/attribute_spec.rb +3 -3
- data/spec/unit/node/immutable_collections_spec.rb +11 -1
- data/spec/unit/node_map_spec.rb +2 -2
- data/spec/unit/node_spec.rb +11 -16
- data/spec/unit/platform/query_helpers_spec.rb +0 -13
- data/spec/unit/policy_builder/policyfile_spec.rb +79 -2
- data/spec/unit/property/validation_spec.rb +51 -4
- data/spec/unit/provider/apt_repository_spec.rb +97 -32
- data/spec/unit/provider/cookbook_file_spec.rb +2 -1
- data/spec/unit/provider/cron/unix_spec.rb +8 -3
- data/spec/unit/provider/cron_spec.rb +27 -32
- data/spec/unit/provider/file_spec.rb +2 -1
- data/spec/unit/provider/group/dscl_spec.rb +7 -8
- data/spec/unit/provider/group/gpasswd_spec.rb +5 -2
- data/spec/unit/provider/group/groupmod_spec.rb +6 -3
- data/spec/unit/provider/group/pw_spec.rb +5 -2
- data/spec/unit/provider/link_spec.rb +6 -4
- data/spec/unit/provider/log_spec.rb +18 -13
- data/spec/unit/provider/mount/aix_spec.rb +1 -9
- data/spec/unit/provider/mount/mount_spec.rb +22 -0
- data/spec/unit/provider/osx_profile_spec.rb +3 -3
- data/spec/unit/provider/package/apt_spec.rb +431 -411
- data/spec/unit/provider/package/{aix_spec.rb → bff_spec.rb} +7 -5
- data/spec/unit/provider/package/chocolatey_spec.rb +0 -13
- data/spec/unit/provider/package/homebrew_spec.rb +2 -1
- data/spec/unit/provider/package/portage_spec.rb +11 -147
- data/spec/unit/provider/package/powershell_spec.rb +208 -57
- data/spec/unit/provider/package/rubygems_spec.rb +11 -2
- data/spec/unit/provider/package/windows_spec.rb +0 -19
- data/spec/unit/provider/package/yum/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/yum/yum_cache_spec.rb +86 -4
- data/spec/unit/provider/package/zypper_spec.rb +8 -0
- data/spec/unit/provider/package_spec.rb +47 -20
- data/spec/unit/provider/registry_key_spec.rb +7 -1
- data/spec/unit/provider/remote_directory_spec.rb +1 -1
- data/spec/unit/provider/remote_file_spec.rb +2 -1
- data/spec/unit/provider/service/macosx_spec.rb +4 -2
- data/spec/unit/provider/service/systemd_service_spec.rb +2 -10
- data/spec/unit/provider/service/windows_spec.rb +447 -30
- data/spec/unit/provider/systemd_unit_spec.rb +50 -13
- data/spec/unit/provider/template_spec.rb +2 -4
- data/spec/unit/provider/user/windows_spec.rb +3 -0
- data/spec/unit/provider/{env_spec.rb → windows_env_spec.rb} +102 -12
- data/spec/unit/provider/zypper_repository_spec.rb +4 -2
- data/spec/unit/provider_resolver_spec.rb +23 -38
- data/spec/unit/recipe_spec.rb +4 -4
- data/spec/unit/resource/apt_package_spec.rb +4 -0
- data/spec/unit/resource/apt_preference_spec.rb +0 -5
- data/spec/unit/resource/apt_repository_spec.rb +35 -10
- data/spec/unit/resource/apt_update_spec.rb +0 -5
- data/spec/unit/resource/bash_spec.rb +2 -3
- data/spec/unit/resource/batch_spec.rb +1 -4
- data/spec/unit/resource/{timestamped_deploy_spec.rb → build_essential_spec.rb} +10 -11
- data/spec/unit/resource/cab_package_spec.rb +1 -3
- data/{lib/chef/mixin/language_include_attribute.rb → spec/unit/resource/chef_handler_spec.rb} +13 -12
- data/spec/unit/resource/chocolatey_package_spec.rb +1 -3
- data/spec/unit/resource/cron_spec.rb +0 -5
- data/spec/unit/resource/csh_spec.rb +2 -3
- data/spec/unit/resource/directory_spec.rb +1 -6
- data/{lib/chef/resource/deploy_revision.rb → spec/unit/resource/dmg_package_spec.rb} +14 -10
- data/spec/unit/resource/dnf_package_spec.rb +20 -26
- data/spec/unit/resource/file_spec.rb +1 -1
- data/spec/unit/resource/freebsd_package_spec.rb +22 -23
- data/spec/unit/resource/gem_package_spec.rb +3 -5
- data/spec/unit/resource/git_spec.rb +1 -2
- data/spec/unit/resource/group_spec.rb +0 -5
- data/spec/unit/resource/homebrew_cask_spec.rb +35 -0
- data/spec/unit/resource/homebrew_package_spec.rb +4 -0
- data/spec/unit/resource/homebrew_tap_spec.rb +39 -0
- data/spec/unit/resource/hostname_spec.rb +43 -0
- data/spec/unit/resource/http_request_spec.rb +0 -5
- data/spec/unit/resource/ips_package_spec.rb +4 -0
- data/spec/unit/resource/ksh_spec.rb +2 -3
- data/spec/unit/resource/launchd_spec.rb +0 -5
- data/spec/unit/resource/link_spec.rb +1 -6
- data/spec/unit/resource/log_spec.rb +0 -5
- data/spec/unit/resource/macos_user_defaults_spec.rb +45 -0
- data/spec/unit/resource/mdadm_spec.rb +0 -5
- data/spec/unit/resource/mount_spec.rb +1 -6
- data/spec/unit/resource/msu_package_spec.rb +1 -3
- data/spec/unit/resource/ohai_hint_spec.rb +43 -0
- data/spec/unit/resource/ohai_spec.rb +0 -5
- data/spec/unit/resource/openbsd_package_spec.rb +8 -12
- data/spec/unit/resource/openssl_dhparam.rb +51 -0
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +59 -0
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +39 -0
- data/spec/unit/resource/osx_profile_spec.rb +0 -5
- data/spec/unit/resource/package_spec.rb +0 -5
- data/spec/unit/resource/perl_spec.rb +2 -3
- data/spec/unit/resource/portage_package_spec.rb +3 -7
- data/spec/unit/resource/powershell_package_spec.rb +11 -4
- data/spec/unit/resource/python_spec.rb +0 -5
- data/spec/unit/resource/reboot_spec.rb +0 -5
- data/spec/unit/resource/registry_key_spec.rb +5 -6
- data/spec/unit/resource/remote_directory_spec.rb +0 -5
- data/spec/unit/resource/remote_file_spec.rb +1 -5
- data/spec/unit/resource/rhsm_errata_level_spec.rb +46 -0
- data/{lib/chef/mixin/language_include_recipe.rb → spec/unit/resource/rhsm_errata_spec.rb} +14 -10
- data/spec/unit/resource/rhsm_register_spec.rb +199 -0
- data/spec/unit/resource/rhsm_repo_spec.rb +59 -0
- data/spec/unit/resource/rhsm_subscription_spec.rb +93 -0
- data/spec/unit/resource/route_spec.rb +1 -6
- data/spec/unit/resource/rpm_package_spec.rb +4 -0
- data/spec/unit/resource/ruby_block_spec.rb +0 -5
- data/spec/unit/resource/ruby_spec.rb +0 -5
- data/spec/unit/resource/scm_spec.rb +0 -15
- data/spec/unit/resource/service_spec.rb +0 -5
- data/spec/unit/resource/subversion_spec.rb +12 -0
- data/spec/unit/resource/sudo_spec.rb +92 -0
- data/spec/unit/resource/swap_file_spec.rb +40 -0
- data/spec/unit/resource/sysctl_spec.rb +56 -0
- data/spec/unit/resource/systemd_unit_spec.rb +5 -7
- data/spec/unit/resource/template_spec.rb +1 -3
- data/spec/unit/resource/user_spec.rb +0 -5
- data/spec/unit/resource/windows_ad_join.rb +45 -0
- data/spec/unit/resource/windows_auto_run_spec.rb +50 -0
- data/spec/unit/resource/{env_spec.rb → windows_env_spec.rb} +19 -21
- data/spec/unit/resource/windows_feature.rb +41 -0
- data/spec/unit/resource/windows_feature_dism.rb +51 -0
- data/spec/unit/resource/windows_feature_powershell.rb +51 -0
- data/spec/unit/resource/windows_font_spec.rb +44 -0
- data/spec/unit/resource/windows_package_spec.rb +2 -2
- data/spec/unit/resource/windows_pagefile_spec.rb +45 -0
- data/spec/unit/resource/windows_printer_port_spec.rb +45 -0
- data/spec/unit/resource/windows_printer_spec.rb +45 -0
- data/spec/unit/resource/windows_service_spec.rb +25 -4
- data/spec/unit/resource/windows_shortcut_spec.rb +39 -0
- data/spec/unit/resource/windows_task_spec.rb +0 -5
- data/spec/unit/resource/yum_repository_spec.rb +4 -0
- data/spec/unit/resource/zypper_repository_spec.rb +4 -0
- data/spec/unit/resource_inspector_spec.rb +60 -0
- data/spec/unit/resource_reporter_spec.rb +2 -2
- data/spec/unit/resource_spec.rb +0 -5
- data/spec/unit/shell/shell_session_spec.rb +0 -1
- data/spec/unit/user_spec.rb +1 -1
- data/spec/unit/util/windows/logon_session_spec.rb +2 -1
- data/spec/unit/win32/security_spec.rb +44 -1
- data/spec/unit/windows_service_spec.rb +4 -2
- data/tasks/announce.rb +1 -1
- data/tasks/cbgb.rb +84 -0
- data/tasks/dependencies.rb +38 -2
- data/tasks/maintainers.rb +7 -7
- data/tasks/rspec.rb +2 -2
- data/tasks/templates/prerelease.md.erb +2 -11
- data/tasks/templates/release.md.erb +1 -9
- metadata +225 -96
- data/lib/chef/knife/help.rb +0 -101
- data/lib/chef/knife/help_topics.rb +0 -4
- data/lib/chef/knife/index_rebuild.rb +0 -133
- data/lib/chef/mixin/language.rb +0 -48
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +0 -35
- data/lib/chef/provider/deploy.rb +0 -470
- data/lib/chef/provider/deploy/revision.rb +0 -107
- data/lib/chef/provider/deploy/timestamped.rb +0 -34
- data/lib/chef/provider/env/windows.rb +0 -76
- data/lib/chef/provider/erl_call.rb +0 -76
- data/lib/chef/provider/package/yum/yum-dump.py +0 -307
- data/lib/chef/resource/deploy.rb +0 -449
- data/lib/chef/resource/erl_call.rb +0 -90
- data/lib/chef/resource/timestamped_deploy.rb +0 -26
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.fc24.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.fc24.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.fc24.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.fc24.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.fc24.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.fc24.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/repodata/313329137b55fd333b2dc66394a6661a2befa6cc535d8460d92a4a78a9c581f0-primary.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/31ac4db5d5ac593728fcc26aef82b7b93c4cc4dbec843786b1845b939b658553-other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/4ac40fa3c6728c1401318e2e20a997436624e83dcf7a5f952b851ef422637773-filelists.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/66391e53f0510b98b3f0b79f40ba1048026d9a1ef20905d9c40ba6f5411f3243-primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/8b34697595fcc87928e12d24644dda9462c3857bd932861e28bc77ae1f31be16-filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/b97cca3fe14bcf06c52be4449b6108f7731239ff221111dcce8aada5467f60dc-other.sqlite.bz2 +0 -0
- data/spec/functional/resource/deploy_revision_spec.rb +0 -881
- data/spec/functional/resource/env_spec.rb +0 -192
- data/spec/unit/knife/index_rebuild_spec.rb +0 -125
- data/spec/unit/knife/knife_help.rb +0 -92
- data/spec/unit/provider/deploy/revision_spec.rb +0 -110
- data/spec/unit/provider/deploy/timestamped_spec.rb +0 -40
- data/spec/unit/provider/deploy_spec.rb +0 -641
- data/spec/unit/provider/env/windows_spec.rb +0 -103
- data/spec/unit/provider/erl_call_spec.rb +0 -77
- data/spec/unit/provider/package/yum_spec.rb +0 -2294
- data/spec/unit/resource/deploy_revision_spec.rb +0 -42
- data/spec/unit/resource/deploy_spec.rb +0 -283
- data/spec/unit/resource/erl_call_spec.rb +0 -81
@@ -28,7 +28,7 @@ class Chef
|
|
28
28
|
|
29
29
|
provides :package, platform: "nexentacore"
|
30
30
|
provides :package, platform: "solaris2", platform_version: "< 5.11"
|
31
|
-
provides :solaris_package
|
31
|
+
provides :solaris_package
|
32
32
|
|
33
33
|
# def initialize(*args)
|
34
34
|
# super
|
@@ -54,7 +54,7 @@ class Chef
|
|
54
54
|
if new_resource.source
|
55
55
|
@package_source_found = ::File.exist?(new_resource.source)
|
56
56
|
if @package_source_found
|
57
|
-
|
57
|
+
logger.trace("#{new_resource} checking pkg status")
|
58
58
|
shell_out_compact_timeout("pkginfo", "-l", "-d", new_resource.source, new_resource.package_name).stdout.each_line do |line|
|
59
59
|
case line
|
60
60
|
when /VERSION:\s+(.+)/
|
@@ -64,12 +64,12 @@ class Chef
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
logger.trace("#{new_resource} checking install state")
|
68
68
|
status = shell_out_compact_timeout("pkginfo", "-l", current_resource.package_name)
|
69
69
|
status.stdout.each_line do |line|
|
70
70
|
case line
|
71
71
|
when /VERSION:\s+(.+)/
|
72
|
-
|
72
|
+
logger.trace("#{new_resource} version #{$1} is already installed")
|
73
73
|
current_resource.version($1)
|
74
74
|
end
|
75
75
|
end
|
@@ -89,7 +89,7 @@ class Chef
|
|
89
89
|
when /VERSION:\s+(.+)/
|
90
90
|
@candidate_version = $1
|
91
91
|
new_resource.version($1)
|
92
|
-
|
92
|
+
logger.trace("#{new_resource} setting install candidate version to #{@candidate_version}")
|
93
93
|
end
|
94
94
|
end
|
95
95
|
unless status.exitstatus == 0
|
@@ -99,7 +99,7 @@ class Chef
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def install_package(name, version)
|
102
|
-
|
102
|
+
logger.trace("#{new_resource} package install options: #{options}")
|
103
103
|
if options.nil?
|
104
104
|
command = if ::File.directory?(new_resource.source) # CHEF-4469
|
105
105
|
[ "pkgadd", "-n", "-d", new_resource.source, new_resource.package_name ]
|
@@ -107,7 +107,7 @@ class Chef
|
|
107
107
|
[ "pkgadd", "-n", "-d", new_resource.source, "all" ]
|
108
108
|
end
|
109
109
|
shell_out_compact_timeout!(command)
|
110
|
-
|
110
|
+
logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}")
|
111
111
|
else
|
112
112
|
command = if ::File.directory?(new_resource.source) # CHEF-4469
|
113
113
|
[ "pkgadd", "-n", options, "-d", new_resource.source, new_resource.package_name ]
|
@@ -115,7 +115,7 @@ class Chef
|
|
115
115
|
[ "pkgadd", "-n", options, "-d", new_resource.source, "all" ]
|
116
116
|
end
|
117
117
|
shell_out_compact_timeout!(*command)
|
118
|
-
|
118
|
+
logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}")
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -124,10 +124,10 @@ class Chef
|
|
124
124
|
def remove_package(name, version)
|
125
125
|
if options.nil?
|
126
126
|
shell_out_compact_timeout!( "pkgrm", "-n", name )
|
127
|
-
|
127
|
+
logger.trace("#{new_resource} removed version #{new_resource.version}")
|
128
128
|
else
|
129
129
|
shell_out_compact_timeout!( "pkgrm", "-n", options, name )
|
130
|
-
|
130
|
+
logger.trace("#{new_resource} removed version #{new_resource.version}")
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -30,7 +30,7 @@ class Chef
|
|
30
30
|
include Chef::Mixin::Checksum
|
31
31
|
|
32
32
|
provides :package, os: "windows"
|
33
|
-
provides :windows_package
|
33
|
+
provides :windows_package
|
34
34
|
|
35
35
|
require "chef/provider/package/windows/registry_uninstall_entry.rb"
|
36
36
|
|
@@ -39,21 +39,13 @@ class Chef
|
|
39
39
|
a.assertion { new_resource.source || msi? }
|
40
40
|
a.failure_message Chef::Exceptions::NoWindowsPackageSource, "Source for package #{new_resource.name} must be specified in the resource's source property for package to be installed because the package_name property is used to test for the package installation state for this package type."
|
41
41
|
end
|
42
|
-
|
43
|
-
unless uri_scheme?(new_resource.source)
|
44
|
-
requirements.assert(:install) do |a|
|
45
|
-
a.assertion { ::File.exist?(new_resource.source) }
|
46
|
-
a.failure_message Chef::Exceptions::Package, "Source for package #{new_resource.name} does not exist"
|
47
|
-
a.whyrun "Assuming source file #{new_resource.source} would have been created."
|
48
|
-
end
|
49
|
-
end
|
50
42
|
end
|
51
43
|
|
52
44
|
# load_current_resource is run in Chef::Provider#run_action when not in whyrun_mode?
|
53
45
|
def load_current_resource
|
54
46
|
@current_resource = Chef::Resource::WindowsPackage.new(new_resource.name)
|
55
47
|
if downloadable_file_missing?
|
56
|
-
|
48
|
+
logger.trace("We do not know the version of #{new_resource.source} because the file is not downloaded")
|
57
49
|
current_resource.version(:unknown.to_s)
|
58
50
|
else
|
59
51
|
current_resource.version(package_provider.installed_version)
|
@@ -67,11 +59,11 @@ class Chef
|
|
67
59
|
@package_provider ||= begin
|
68
60
|
case installer_type
|
69
61
|
when :msi
|
70
|
-
|
62
|
+
logger.trace("#{new_resource} is MSI")
|
71
63
|
require "chef/provider/package/windows/msi"
|
72
64
|
Chef::Provider::Package::Windows::MSI.new(resource_for_provider, uninstall_registry_entries)
|
73
65
|
else
|
74
|
-
|
66
|
+
logger.trace("#{new_resource} is EXE with type '#{installer_type}'")
|
75
67
|
require "chef/provider/package/windows/exe"
|
76
68
|
Chef::Provider::Package::Windows::Exe.new(resource_for_provider, installer_type, uninstall_registry_entries)
|
77
69
|
end
|
@@ -177,7 +169,7 @@ class Chef
|
|
177
169
|
end
|
178
170
|
|
179
171
|
def version_equals?(current_version, new_version)
|
180
|
-
|
172
|
+
logger.trace("Checking if #{new_resource} version '#{new_version}' is already installed. #{current_version} is currently installed")
|
181
173
|
if current_version.is_a?(Array)
|
182
174
|
current_version.include?(new_version)
|
183
175
|
else
|
@@ -229,13 +221,12 @@ class Chef
|
|
229
221
|
r.timeout(new_resource.timeout)
|
230
222
|
r.returns(new_resource.returns)
|
231
223
|
r.options(new_resource.options)
|
232
|
-
r.sensitive(new_resource.sensitive)
|
233
224
|
end
|
234
225
|
end
|
235
226
|
|
236
227
|
def download_source_file
|
237
228
|
source_resource.run_action(:create)
|
238
|
-
|
229
|
+
logger.trace("#{new_resource} fetched source file to #{source_resource.path}")
|
239
230
|
end
|
240
231
|
|
241
232
|
def source_resource
|
@@ -28,11 +28,13 @@ class Chef
|
|
28
28
|
|
29
29
|
def initialize(resource, installer_type, uninstall_entries)
|
30
30
|
@new_resource = resource
|
31
|
+
@logger = new_resource.logger
|
31
32
|
@installer_type = installer_type
|
32
33
|
@uninstall_entries = uninstall_entries
|
33
34
|
end
|
34
35
|
|
35
36
|
attr_reader :new_resource
|
37
|
+
attr_reader :logger
|
36
38
|
attr_reader :installer_type
|
37
39
|
attr_reader :uninstall_entries
|
38
40
|
|
@@ -43,7 +45,7 @@ class Chef
|
|
43
45
|
|
44
46
|
# Returns a version if the package is installed or nil if it is not.
|
45
47
|
def installed_version
|
46
|
-
|
48
|
+
logger.trace("#{new_resource} checking package version")
|
47
49
|
current_installed_version
|
48
50
|
end
|
49
51
|
|
@@ -52,7 +54,7 @@ class Chef
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def install_package
|
55
|
-
|
57
|
+
logger.trace("#{new_resource} installing #{new_resource.installer_type} package '#{new_resource.source}'")
|
56
58
|
shell_out!(
|
57
59
|
[
|
58
60
|
"start",
|
@@ -62,7 +64,7 @@ class Chef
|
|
62
64
|
unattended_flags,
|
63
65
|
expand_options(new_resource.options),
|
64
66
|
"& exit %%%%ERRORLEVEL%%%%",
|
65
|
-
].join(" "), timeout: new_resource.timeout, returns: new_resource.returns
|
67
|
+
].join(" "), timeout: new_resource.timeout, returns: new_resource.returns
|
66
68
|
)
|
67
69
|
end
|
68
70
|
|
@@ -70,7 +72,7 @@ class Chef
|
|
70
72
|
uninstall_version = new_resource.version || current_installed_version
|
71
73
|
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
|
72
74
|
.map(&:uninstall_string).uniq.each do |uninstall_string|
|
73
|
-
|
75
|
+
logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'")
|
74
76
|
shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns)
|
75
77
|
end
|
76
78
|
end
|
@@ -31,10 +31,12 @@ class Chef
|
|
31
31
|
|
32
32
|
def initialize(resource, uninstall_entries)
|
33
33
|
@new_resource = resource
|
34
|
+
@logger = new_resource.logger
|
34
35
|
@uninstall_entries = uninstall_entries
|
35
36
|
end
|
36
37
|
|
37
38
|
attr_reader :new_resource
|
39
|
+
attr_reader :logger
|
38
40
|
attr_reader :uninstall_entries
|
39
41
|
|
40
42
|
# From Chef::Provider::Package
|
@@ -45,9 +47,9 @@ class Chef
|
|
45
47
|
# Returns a version if the package is installed or nil if it is not.
|
46
48
|
def installed_version
|
47
49
|
if !new_resource.source.nil? && ::File.exist?(new_resource.source)
|
48
|
-
|
50
|
+
logger.trace("#{new_resource} getting product code for package at #{new_resource.source}")
|
49
51
|
product_code = get_product_property(new_resource.source, "ProductCode")
|
50
|
-
|
52
|
+
logger.trace("#{new_resource} checking package status and version for #{product_code}")
|
51
53
|
get_installed_version(product_code)
|
52
54
|
else
|
53
55
|
if uninstall_entries.count != 0
|
@@ -59,21 +61,21 @@ class Chef
|
|
59
61
|
def package_version
|
60
62
|
return new_resource.version if new_resource.version
|
61
63
|
if !new_resource.source.nil? && ::File.exist?(new_resource.source)
|
62
|
-
|
64
|
+
logger.trace("#{new_resource} getting product version for package at #{new_resource.source}")
|
63
65
|
get_product_property(new_resource.source, "ProductVersion")
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
69
|
def install_package
|
68
70
|
# We could use MsiConfigureProduct here, but we'll start off with msiexec
|
69
|
-
|
71
|
+
logger.trace("#{new_resource} installing MSI package '#{new_resource.source}'")
|
70
72
|
shell_out!("msiexec /qn /i \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns)
|
71
73
|
end
|
72
74
|
|
73
75
|
def remove_package
|
74
76
|
# We could use MsiConfigureProduct here, but we'll start off with msiexec
|
75
77
|
if !new_resource.source.nil? && ::File.exist?(new_resource.source)
|
76
|
-
|
78
|
+
logger.trace("#{new_resource} removing MSI package '#{new_resource.source}'")
|
77
79
|
shell_out!("msiexec /qn /x \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns)
|
78
80
|
else
|
79
81
|
uninstall_version = new_resource.version || installed_version
|
@@ -82,7 +84,7 @@ class Chef
|
|
82
84
|
uninstall_string = "msiexec /x #{uninstall_string.match(/{.*}/)}"
|
83
85
|
uninstall_string += expand_options(new_resource.options)
|
84
86
|
uninstall_string += " /q" unless uninstall_string.downcase =~ / \/q/
|
85
|
-
|
87
|
+
logger.trace("#{new_resource} removing MSI package version using '#{uninstall_string}'")
|
86
88
|
shell_out!(uninstall_string, timeout: new_resource.timeout, returns: new_resource.returns)
|
87
89
|
end
|
88
90
|
end
|
@@ -26,7 +26,7 @@ class Chef
|
|
26
26
|
class RegistryUninstallEntry
|
27
27
|
|
28
28
|
def self.find_entries(package_name)
|
29
|
-
|
29
|
+
logger.trace("Finding uninstall entries for #{package_name}")
|
30
30
|
entries = []
|
31
31
|
[
|
32
32
|
[::Win32::Registry::HKEY_LOCAL_MACHINE, (::Win32::Registry::Constants::KEY_READ | 0x0100)],
|
@@ -45,12 +45,12 @@ class Chef
|
|
45
45
|
entries.push(quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry))
|
46
46
|
end
|
47
47
|
rescue ::Win32::Registry::Error => ex
|
48
|
-
|
48
|
+
logger.trace("Registry error opening key '#{key}' on node #{desired}: #{ex}")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
52
|
rescue ::Win32::Registry::Error => ex
|
53
|
-
|
53
|
+
logger.trace("Registry error opening hive '#{hkey[0]}' :: #{desired}: #{ex}")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
entries
|
@@ -63,13 +63,18 @@ class Chef
|
|
63
63
|
|
64
64
|
def self.read_registry_property(data, property)
|
65
65
|
data[property]
|
66
|
-
rescue ::Win32::Registry::Error
|
67
|
-
|
66
|
+
rescue ::Win32::Registry::Error
|
67
|
+
logger.trace("Failure to read property '#{property}'")
|
68
68
|
nil
|
69
69
|
end
|
70
70
|
|
71
|
+
def self.logger
|
72
|
+
Chef::Log
|
73
|
+
end
|
74
|
+
|
71
75
|
def initialize(hive, key, registry_data, uninstall_key = "UninstallString")
|
72
|
-
Chef::Log.
|
76
|
+
@logger = Chef::Log.with_child({ subsystem: "registry_uninstall_entry" })
|
77
|
+
logger.trace("Creating uninstall entry for #{hive}::#{key}")
|
73
78
|
@hive = hive
|
74
79
|
@key = key
|
75
80
|
@data = registry_data
|
@@ -84,6 +89,7 @@ class Chef
|
|
84
89
|
attr_reader :display_version
|
85
90
|
attr_reader :uninstall_string
|
86
91
|
attr_reader :data
|
92
|
+
attr_reader :logger
|
87
93
|
|
88
94
|
UNINSTALL_SUBKEY = 'Software\Microsoft\Windows\CurrentVersion\Uninstall'.freeze
|
89
95
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Copyright:: Copyright 2008-2017, Chef Software Inc.
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2016-2018, Chef Software Inc.
|
4
3
|
# License:: Apache License, Version 2.0
|
5
4
|
#
|
6
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,487 +15,264 @@
|
|
16
15
|
# limitations under the License.
|
17
16
|
#
|
18
17
|
|
19
|
-
require "chef/config"
|
20
18
|
require "chef/provider/package"
|
21
19
|
require "chef/resource/yum_package"
|
20
|
+
require "chef/mixin/which"
|
21
|
+
require "chef/mixin/shell_out"
|
22
22
|
require "chef/mixin/get_source_from_package"
|
23
|
-
require "chef/provider/package/yum/
|
23
|
+
require "chef/provider/package/yum/python_helper"
|
24
|
+
require "chef/provider/package/yum/version"
|
25
|
+
# the stubs in the YumCache class are still an external API
|
24
26
|
require "chef/provider/package/yum/yum_cache"
|
25
27
|
|
26
28
|
class Chef
|
27
29
|
class Provider
|
28
30
|
class Package
|
29
31
|
class Yum < Chef::Provider::Package
|
32
|
+
extend Chef::Mixin::Which
|
33
|
+
extend Chef::Mixin::ShellOut
|
30
34
|
include Chef::Mixin::GetSourceFromPackage
|
31
35
|
|
32
|
-
provides :package, platform_family: %w{rhel fedora amazon}
|
33
|
-
provides :yum_package, os: "linux"
|
34
|
-
|
35
|
-
# Multipackage API
|
36
36
|
allow_nils
|
37
37
|
use_multipackage_api
|
38
38
|
use_package_name_for_source
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
provides :package, platform_family: %w{fedora amazon rhel}
|
41
|
+
|
42
|
+
provides :yum_package
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
#
|
45
|
+
# Most of the magic in this class happens in the python helper script. The ruby side of this
|
46
|
+
# provider knows only enough to translate Chef-style new_resource name+package+version into
|
47
|
+
# a request to the python side. The python side is then responsible for knowing everything
|
48
|
+
# about RPMs and what is installed and what is available. The ruby side of this class should
|
49
|
+
# remain a lightweight translation layer to translate Chef requests into RPC requests to
|
50
|
+
# python. This class knows nothing about how to compare RPM versions, and does not maintain
|
51
|
+
# any cached state of installed/available versions and should be kept that way.
|
52
|
+
#
|
53
|
+
def python_helper
|
54
|
+
@python_helper ||= PythonHelper.instance
|
46
55
|
end
|
47
56
|
|
48
|
-
|
49
|
-
|
50
|
-
super
|
57
|
+
def load_current_resource
|
58
|
+
flushcache if new_resource.flush_cache[:before]
|
51
59
|
|
52
|
-
|
53
|
-
|
54
|
-
|
60
|
+
@current_resource = Chef::Resource::YumPackage.new(new_resource.name)
|
61
|
+
current_resource.package_name(new_resource.package_name)
|
62
|
+
current_resource.version(get_current_versions)
|
55
63
|
|
56
|
-
|
57
|
-
raise Chef::Exceptions::InvalidResourceSpecification, "Please provide an architecture for each package. Use `nil` for default architecture."
|
58
|
-
end
|
64
|
+
current_resource
|
59
65
|
end
|
60
66
|
|
61
|
-
# @see Chef::Provider#define_resource_requirements
|
62
67
|
def define_resource_requirements
|
63
|
-
super
|
64
|
-
|
65
|
-
# Ensure that the source file (if specified) is present on the file system
|
66
68
|
requirements.assert(:install, :upgrade, :remove, :purge) do |a|
|
67
69
|
a.assertion { !new_resource.source || ::File.exist?(new_resource.source) }
|
68
70
|
a.failure_message Chef::Exceptions::Package, "Package #{new_resource.package_name} not found: #{new_resource.source}"
|
69
71
|
a.whyrun "assuming #{new_resource.source} would have previously been created"
|
70
72
|
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# @see Chef::Provider#load_current_resource
|
74
|
-
def load_current_resource
|
75
|
-
@yum.reload if flush_cache[:before]
|
76
|
-
manage_extra_repo_control
|
77
|
-
|
78
|
-
if new_resource.source
|
79
|
-
query_source_file
|
80
|
-
else
|
81
|
-
# At this point package_name could be:
|
82
|
-
#
|
83
|
-
# 1) a package name, eg: "foo"
|
84
|
-
# 2) a package name.arch, eg: "foo.i386"
|
85
|
-
# 3) or a dependency, eg: "foo >= 1.1"
|
86
|
-
#
|
87
|
-
# In the third case, we want to convert those dependency strings into
|
88
|
-
# packages that we can actually install
|
89
|
-
convert_dependency_strings_into_packages
|
90
|
-
|
91
|
-
# Fill out the rest of the details by querying the Yum Cache
|
92
|
-
query_yum_cache
|
93
|
-
end
|
94
73
|
|
95
|
-
|
96
|
-
current_resource.package_name(new_resource.package_name)
|
97
|
-
current_resource.version(@installed_version)
|
98
|
-
current_resource
|
74
|
+
super
|
99
75
|
end
|
100
76
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
locked = shell_out_with_timeout!("yum versionlock")
|
105
|
-
locked.stdout.each_line do |line|
|
106
|
-
line_package = line.sub(/-[^-]*-[^-]*$/, "").split(":").last.strip
|
107
|
-
if line_package == name
|
108
|
-
islocked = true
|
109
|
-
end
|
77
|
+
def candidate_version
|
78
|
+
package_name_array.each_with_index.map do |pkg, i|
|
79
|
+
available_version(i).version_with_arch
|
110
80
|
end
|
111
|
-
islocked
|
112
81
|
end
|
113
82
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
# @see Chef::Provider::Package#install_package
|
119
|
-
def install_package(name, version)
|
120
|
-
if new_resource.source
|
121
|
-
yum_command("-d0 -e0 -y#{expand_options(new_resource.options)} localinstall #{new_resource.source}")
|
122
|
-
else
|
123
|
-
install_remote_package(name, version)
|
83
|
+
def get_current_versions
|
84
|
+
package_name_array.each_with_index.map do |pkg, i|
|
85
|
+
installed_version(i).version_with_arch
|
124
86
|
end
|
125
|
-
|
126
|
-
flush_cache[:after] ? @yum.reload : @yum.reload_installed
|
127
87
|
end
|
128
88
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
89
|
+
def install_package(names, versions)
|
90
|
+
method = nil
|
91
|
+
methods = []
|
92
|
+
names.each_with_index do |n, i|
|
93
|
+
next if n.nil?
|
133
94
|
|
134
|
-
|
135
|
-
def remove_package(name, version)
|
136
|
-
remove_str = full_package_name(name, version).join(" ")
|
137
|
-
yum_command("-d0 -e0 -y#{expand_options(new_resource.options)} remove #{remove_str}")
|
95
|
+
av = available_version(i)
|
138
96
|
|
139
|
-
|
140
|
-
end
|
97
|
+
name = av.name # resolve the name via the available/candidate version
|
141
98
|
|
142
|
-
|
143
|
-
def purge_package(name, version)
|
144
|
-
remove_package(name, version)
|
145
|
-
end
|
99
|
+
iv = python_helper.package_query(:whatinstalled, name)
|
146
100
|
|
147
|
-
|
148
|
-
def lock_package(name, version)
|
149
|
-
lock_str = full_package_name(name, as_array(name).map { nil }).join(" ")
|
150
|
-
yum_command("-d0 -e0 -y#{expand_options(new_resource.options)} versionlock add #{lock_str}")
|
151
|
-
end
|
152
|
-
|
153
|
-
# @see Chef::Provider::Package#unlock_package
|
154
|
-
def unlock_package(name, version)
|
155
|
-
unlock_str = full_package_name(name, as_array(name).map { nil }).join(" ")
|
156
|
-
yum_command("-d0 -e0 -y#{expand_options(new_resource.options)} versionlock delete #{unlock_str}")
|
157
|
-
end
|
158
|
-
|
159
|
-
private
|
101
|
+
method = "install"
|
160
102
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
@yum_binary ||=
|
167
|
-
begin
|
168
|
-
yum_binary = new_resource.yum_binary if new_resource.is_a?(Chef::Resource::YumPackage)
|
169
|
-
yum_binary ||= ::File.exist?("/usr/bin/yum-deprecated") ? "yum-deprecated" : "yum"
|
103
|
+
# If this is a package like the kernel that can be installed multiple times, we'll skip over this logic
|
104
|
+
if new_resource.allow_downgrade && version_gt?(iv.version_with_arch, av.version_with_arch) && !python_helper.install_only_packages(name)
|
105
|
+
# We allow downgrading only in the evenit of single-package
|
106
|
+
# rules where the user explicitly allowed it
|
107
|
+
method = "downgrade"
|
170
108
|
end
|
171
|
-
end
|
172
109
|
|
173
|
-
|
174
|
-
|
175
|
-
end
|
110
|
+
methods << method
|
111
|
+
end
|
176
112
|
|
177
|
-
|
178
|
-
|
179
|
-
if
|
180
|
-
|
181
|
-
|
182
|
-
repo_control << opt if opt =~ /--(enable|disable)repo=.+/
|
183
|
-
end
|
113
|
+
# We could split this up into two commands if we wanted to, but
|
114
|
+
# for now, just don't support this.
|
115
|
+
if methods.uniq.length > 1
|
116
|
+
raise Chef::Exceptions::Package, "Multipackage rule has a mix of upgrade and downgrade packages. Cannot proceed."
|
117
|
+
end
|
184
118
|
|
185
|
-
|
186
|
-
|
187
|
-
else
|
188
|
-
@yum.disable_extra_repo_control
|
189
|
-
end
|
119
|
+
if new_resource.source
|
120
|
+
yum(options, "-y #{method}", new_resource.source)
|
190
121
|
else
|
191
|
-
|
122
|
+
resolved_names = names.each_with_index.map { |name, i| available_version(i).to_s unless name.nil? }
|
123
|
+
yum(options, "-y #{method}", resolved_names)
|
192
124
|
end
|
125
|
+
flushcache
|
193
126
|
end
|
194
127
|
|
195
|
-
#
|
196
|
-
|
197
|
-
installed_versions = []
|
198
|
-
candidate_versions = []
|
199
|
-
|
200
|
-
package_name_array.each_with_index do |n, idx|
|
201
|
-
pkg_name, eval_pkg_arch = parse_arch(n)
|
128
|
+
# yum upgrade does not work on uninstalled packaged, while install will upgrade
|
129
|
+
alias upgrade_package install_package
|
202
130
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
131
|
+
def remove_package(names, versions)
|
132
|
+
resolved_names = names.each_with_index.map { |name, i| installed_version(i).to_s unless name.nil? }
|
133
|
+
yum(options, "-y remove", resolved_names)
|
134
|
+
flushcache
|
135
|
+
end
|
207
136
|
|
208
|
-
|
209
|
-
installed_versions << iv = @yum.installed_version(pkg_name, pkg_arch)
|
210
|
-
candidate_versions << cv = @yum.candidate_version(pkg_name, pkg_arch)
|
137
|
+
alias purge_package remove_package
|
211
138
|
|
212
|
-
|
213
|
-
|
139
|
+
action :flush_cache do
|
140
|
+
flushcache
|
141
|
+
end
|
214
142
|
|
215
|
-
|
216
|
-
|
143
|
+
# NB: the yum_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard
|
144
|
+
# support to lock / unlock. The best solution is to write an execute resource which does a not_if `yum versionlock | grep '^pattern`` kind of approach
|
145
|
+
def lock_package(names, versions)
|
146
|
+
yum("-d0 -e0 -y", options, "versionlock add", resolved_package_lock_names(names))
|
217
147
|
end
|
218
148
|
|
219
|
-
#
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
n = $1
|
226
|
-
v = $2
|
227
|
-
a = $3
|
228
|
-
|
229
|
-
unless new_resource.package_name == n
|
230
|
-
Chef::Log.debug("#{new_resource} updating package_name from #{new_resource.package_name} to #{n} (per #{new_resource.source})")
|
231
|
-
new_resource.package_name(n)
|
232
|
-
end
|
149
|
+
# NB: the yum_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard
|
150
|
+
# support to lock / unlock. The best solution is to write an execute resource which does a only_if `yum versionlock | grep '^pattern`` kind of approach
|
151
|
+
def unlock_package(names, versions)
|
152
|
+
# yum versionlock delete on rhel6 needs the glob nonsense in the following command
|
153
|
+
yum("-d0 -e0 -y", options, "versionlock delete", resolved_package_lock_names(names).map { |n| "'*:#{n}-*'" })
|
154
|
+
end
|
233
155
|
|
234
|
-
|
235
|
-
Chef::Log.debug("#{new_resource} updating version from #{new_resource.version} to #{v} (per #{new_resource.source})")
|
236
|
-
new_resource.version(v)
|
237
|
-
end
|
156
|
+
private
|
238
157
|
|
239
|
-
|
240
|
-
|
241
|
-
|
158
|
+
# this will resolve things like `/usr/bin/perl` or virtual packages like `mysql` -- it will not work (well? at all?) with globs that match multiple packages
|
159
|
+
def resolved_package_lock_names(names)
|
160
|
+
names.each_with_index.map do |name, i|
|
161
|
+
if !name.nil?
|
162
|
+
if installed_version(i).version.nil?
|
163
|
+
available_version(i).name
|
164
|
+
else
|
165
|
+
installed_version(i).name
|
242
166
|
end
|
243
167
|
end
|
244
168
|
end
|
245
|
-
|
246
|
-
@installed_version = @yum.installed_version(new_resource.package_name, new_resource.arch)
|
247
|
-
@candidate_version = new_resource.version
|
248
169
|
end
|
249
170
|
|
250
|
-
def
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
# cause yum to emit a non fatal warning but still exit(1). As there's currently no
|
258
|
-
# way to suppress this behavior and an exit(1) will break a Chef run we make an
|
259
|
-
# effort to trap these and re-run the same install command - it will either fail a
|
260
|
-
# second time or succeed.
|
261
|
-
#
|
262
|
-
# A cleaner solution would have to be done in python and better hook into
|
263
|
-
# yum/rpm to handle exceptions as we see fit.
|
264
|
-
if status.exitstatus == 1
|
265
|
-
status.stdout.each_line do |l|
|
266
|
-
# rpm-4.4.2.3 lib/psm.c line 2182
|
267
|
-
next unless l =~ /^error: %(post|postun)\(.*\) scriptlet failed, exit status \d+$/
|
268
|
-
Chef::Log.warn("#{new_resource} caught non-fatal scriptlet issue: \"#{l}\". Can't trust yum exit status " \
|
269
|
-
"so running install again to verify.")
|
270
|
-
status = shell_out_with_timeout(command, timeout: Chef::Config[:yum_timeout])
|
271
|
-
break
|
171
|
+
def locked_packages
|
172
|
+
@locked_packages ||=
|
173
|
+
begin
|
174
|
+
locked = shell_out_with_timeout!("yum versionlock list")
|
175
|
+
locked.stdout.each_line.map do |line|
|
176
|
+
line.sub(/-[^-]*-[^-]*$/, "").split(":").last.strip
|
177
|
+
end
|
272
178
|
end
|
273
|
-
end
|
274
|
-
|
275
|
-
if status.exitstatus > 0
|
276
|
-
command_output = "STDOUT: #{status.stdout}\nSTDERR: #{status.stderr}"
|
277
|
-
raise Chef::Exceptions::Exec, "#{command} returned #{status.exitstatus}:\n#{command_output}"
|
278
|
-
end
|
279
179
|
end
|
280
180
|
|
281
|
-
def
|
282
|
-
|
283
|
-
|
284
|
-
@yum.version_available?(n, v, a)
|
285
|
-
end
|
286
|
-
|
287
|
-
method = log_method = nil
|
288
|
-
methods = []
|
289
|
-
if all_avail
|
290
|
-
# More Yum fun:
|
291
|
-
#
|
292
|
-
# yum install of an old name+version will exit(1)
|
293
|
-
# yum install of an old name+version+arch will exit(0) for some reason
|
294
|
-
#
|
295
|
-
# Some packages can be installed multiple times like the kernel
|
296
|
-
as_array(name).zip(current_version_array, as_array(version), safe_arch_array).each do |n, cv, v, a|
|
297
|
-
next if n.nil?
|
298
|
-
|
299
|
-
method = "install"
|
300
|
-
log_method = "installing"
|
301
|
-
|
302
|
-
unless @yum.allow_multi_install.include?(n)
|
303
|
-
if RPMVersion.parse(cv) > RPMVersion.parse(v)
|
304
|
-
# We allow downgrading only in the evenit of single-package
|
305
|
-
# rules where the user explicitly allowed it
|
306
|
-
if allow_downgrade
|
307
|
-
method = "downgrade"
|
308
|
-
log_method = "downgrading"
|
309
|
-
else
|
310
|
-
# we bail like yum when the package is older
|
311
|
-
raise Chef::Exceptions::Package, "Installed package #{yum_syntax(n, cv, a)} is newer " \
|
312
|
-
"than candidate package #{yum_syntax(n, v, a)}"
|
313
|
-
end
|
314
|
-
end
|
315
|
-
end
|
316
|
-
# methods don't count for packages we won't be touching
|
317
|
-
next if RPMVersion.parse(cv) == RPMVersion.parse(v)
|
318
|
-
methods << method
|
319
|
-
end
|
181
|
+
def packages_all_locked?(names, versions)
|
182
|
+
resolved_package_lock_names(names).all? { |n| locked_packages.include? n }
|
183
|
+
end
|
320
184
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
raise Chef::Exceptions::Package, "Multipackage rule #{name} has a mix of upgrade and downgrade packages. Cannot proceed."
|
325
|
-
end
|
185
|
+
def packages_all_unlocked?(names, versions)
|
186
|
+
!resolved_package_lock_names(names).any? { |n| locked_packages.include? n }
|
187
|
+
end
|
326
188
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
next if n.nil?
|
331
|
-
next if v == cv
|
332
|
-
s = yum_syntax(n, v, a)
|
333
|
-
repo = @yum.package_repository(n, v, a)
|
334
|
-
repos << "#{s} from #{repo} repository"
|
335
|
-
pkg_string_bits << s
|
336
|
-
end
|
337
|
-
pkg_string = pkg_string_bits.join(" ")
|
338
|
-
Chef::Log.info("#{new_resource} #{log_method} #{repos.join(' ')}")
|
339
|
-
yum_command("-d0 -e0 -y#{expand_options(new_resource.options)} #{method} #{pkg_string}")
|
340
|
-
else
|
341
|
-
raise Chef::Exceptions::Package, "Version #{version} of #{name} not found. Did you specify both version " \
|
342
|
-
"and release? (version-release, e.g. 1.84-10.fc6)"
|
343
|
-
end
|
189
|
+
def version_gt?(v1, v2)
|
190
|
+
return false if v1.nil? || v2.nil?
|
191
|
+
python_helper.compare_versions(v1, v2) == 1
|
344
192
|
end
|
345
193
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
new_package_name = $1
|
350
|
-
new_arch = $2
|
351
|
-
# foo.i386 and foo.beta1 are both valid package names or expressions of an arch.
|
352
|
-
# Ensure we don't have an existing package matching package_name, then ensure we at
|
353
|
-
# least have a match for the new_package+new_arch before we overwrite. If neither
|
354
|
-
# then fall through to standard package handling.
|
355
|
-
old_installed = @yum.installed_version(package_name)
|
356
|
-
old_candidate = @yum.candidate_version(package_name)
|
357
|
-
new_installed = @yum.installed_version(new_package_name, new_arch)
|
358
|
-
new_candidate = @yum.candidate_version(new_package_name, new_arch)
|
359
|
-
if (old_installed.nil? && old_candidate.nil?) && (new_installed || new_candidate)
|
360
|
-
Chef::Log.debug("Parsed out arch #{new_arch}, new package name is #{new_package_name}")
|
361
|
-
return new_package_name, new_arch
|
362
|
-
end
|
363
|
-
end
|
364
|
-
[package_name, nil]
|
194
|
+
def version_equals?(v1, v2)
|
195
|
+
return false if v1.nil? || v2.nil?
|
196
|
+
python_helper.compare_versions(v1, v2) == 0
|
365
197
|
end
|
366
198
|
|
367
|
-
|
368
|
-
|
369
|
-
|
199
|
+
def version_compare(v1, v2)
|
200
|
+
return false if v1.nil? || v2.nil?
|
201
|
+
python_helper.compare_versions(v1, v2)
|
202
|
+
end
|
370
203
|
|
371
|
-
#
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
# If they aren't in the installed packages they could be a dependency.
|
378
|
-
dep = parse_dependency(n, new_version_array[index])
|
379
|
-
if dep
|
380
|
-
if new_resource.package_name.is_a?(Array)
|
381
|
-
new_resource.package_name(package_name_array - [n] + [dep.first])
|
382
|
-
new_resource.version(new_version_array - [new_version_array[index]] + [dep.last]) if dep.last
|
383
|
-
else
|
384
|
-
new_resource.package_name(dep.first)
|
385
|
-
new_resource.version(dep.last) if dep.last
|
386
|
-
end
|
387
|
-
end
|
388
|
-
end
|
204
|
+
# Generate the yum syntax for the package
|
205
|
+
def yum_syntax(name, version, arch)
|
206
|
+
s = name
|
207
|
+
s += "-#{version}" if version
|
208
|
+
s += ".#{arch}" if arch
|
209
|
+
s
|
389
210
|
end
|
390
211
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
# matching them up with an actual package so the standard resource handling can apply.
|
399
|
-
#
|
400
|
-
# There is currently no support for filename matching.
|
401
|
-
#
|
402
|
-
# Note: This was largely left alone during the multipackage refactor
|
403
|
-
def parse_dependency(name, version)
|
404
|
-
# Transform the package_name into a requirement
|
405
|
-
|
406
|
-
# If we are passed a version or a version constraint we have to assume it's a requirement first. If it can't be
|
407
|
-
# parsed only yum_require.name will be set and new_resource.version will be left intact
|
408
|
-
require_string = if version
|
409
|
-
"#{name} #{version}"
|
410
|
-
else
|
411
|
-
# Transform the package_name into a requirement, might contain a version, could just be
|
412
|
-
# a match for virtual provides
|
413
|
-
name
|
414
|
-
end
|
415
|
-
yum_require = RPMRequire.parse(require_string)
|
416
|
-
# and gather all the packages that have a Provides feature satisfying the requirement.
|
417
|
-
# It could be multiple be we can only manage one
|
418
|
-
packages = @yum.packages_from_require(yum_require)
|
419
|
-
|
420
|
-
if packages.empty?
|
421
|
-
# Don't bother if we are just ensuring a package is removed - we don't need Provides data
|
422
|
-
actions = Array(new_resource.action)
|
423
|
-
unless actions.size == 1 && (actions[0] == :remove || actions[0] == :purge)
|
424
|
-
Chef::Log.debug("#{new_resource} couldn't match #{new_resource.package_name} in " \
|
425
|
-
"installed Provides, loading available Provides - this may take a moment")
|
426
|
-
@yum.reload_provides
|
427
|
-
packages = @yum.packages_from_require(yum_require)
|
212
|
+
def resolve_source_to_version_obj
|
213
|
+
shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line|
|
214
|
+
# this is another case of committing the sin of doing some lightweight mangling of RPM versions in ruby -- but the output of the rpm command
|
215
|
+
# does not match what the yum library accepts.
|
216
|
+
case line
|
217
|
+
when /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/
|
218
|
+
return Version.new($1, "#{$2 == '(none)' ? '0' : $2}:#{$3}-#{$4}", $5)
|
428
219
|
end
|
429
220
|
end
|
221
|
+
end
|
430
222
|
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
debug_msg = "#{name}: Unable to match package '#{name}' but matched #{packages.size} "
|
435
|
-
debug_msg << (packages.size == 1 ? "package" : "packages")
|
436
|
-
debug_msg << ", selected '#{new_package_name}' version '#{new_package_version}'"
|
437
|
-
Chef::Log.debug(debug_msg)
|
438
|
-
|
439
|
-
# Ensure it's not the same package under a different architecture
|
440
|
-
unique_names = []
|
441
|
-
packages.each do |pkg|
|
442
|
-
unique_names << "#{pkg.name}-#{pkg.version.evr}"
|
443
|
-
end
|
444
|
-
unique_names.uniq!
|
223
|
+
# @returns Array<Version>
|
224
|
+
def available_version(index)
|
225
|
+
@available_version ||= []
|
445
226
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
227
|
+
@available_version[index] ||= if new_resource.source
|
228
|
+
resolve_source_to_version_obj
|
229
|
+
else
|
230
|
+
python_helper.package_query(:whatavailable, package_name_array[index], version: safe_version_array[index], arch: safe_arch_array[index], options: options)
|
231
|
+
end
|
451
232
|
|
452
|
-
|
453
|
-
new_package_version = nil
|
454
|
-
end
|
455
|
-
|
456
|
-
[new_package_name, new_package_version]
|
457
|
-
end
|
233
|
+
@available_version[index]
|
458
234
|
end
|
459
235
|
|
460
|
-
#
|
461
|
-
|
462
|
-
|
236
|
+
# @returns Array<Version>
|
237
|
+
def installed_version(index)
|
238
|
+
@installed_version ||= []
|
239
|
+
@installed_version[index] ||= if new_resource.source
|
240
|
+
python_helper.package_query(:whatinstalled, available_version(index).name, version: safe_version_array[index], arch: safe_arch_array[index])
|
241
|
+
else
|
242
|
+
python_helper.package_query(:whatinstalled, package_name_array[index], version: safe_version_array[index], arch: safe_arch_array[index])
|
243
|
+
end
|
244
|
+
@installed_version[index]
|
245
|
+
end
|
463
246
|
|
464
|
-
#
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
247
|
+
# cache flushing is accomplished by simply restarting the python helper. this produces a roughly
|
248
|
+
# 15% hit to the runtime of installing/removing/upgrading packages. correctly using multipackage
|
249
|
+
# array installs (and the multipackage cookbook) can produce 600% improvements in runtime.
|
250
|
+
def flushcache
|
251
|
+
python_helper.restart
|
469
252
|
end
|
470
253
|
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
254
|
+
def yum_binary
|
255
|
+
@yum_binary ||=
|
256
|
+
begin
|
257
|
+
yum_binary = new_resource.yum_binary if new_resource.is_a?(Chef::Resource::YumPackage)
|
258
|
+
yum_binary ||= ::File.exist?("/usr/bin/yum-deprecated") ? "yum-deprecated" : "yum"
|
259
|
+
end
|
477
260
|
end
|
478
261
|
|
479
|
-
|
480
|
-
|
481
|
-
if new_resource.package_name.is_a?(String)
|
482
|
-
new_resource.package_name(name)
|
483
|
-
else
|
484
|
-
new_resource.package_name[idx] = name
|
485
|
-
end
|
262
|
+
def yum(*args)
|
263
|
+
shell_out_with_timeout!(a_to_s(yum_binary, *args))
|
486
264
|
end
|
487
265
|
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
266
|
+
def safe_version_array
|
267
|
+
if new_resource.version.is_a?(Array)
|
268
|
+
new_resource.version
|
269
|
+
elsif new_resource.version.nil?
|
270
|
+
package_name_array.map { nil }
|
492
271
|
else
|
493
|
-
new_resource.
|
494
|
-
new_resource.arch[idx] = arch
|
272
|
+
[ new_resource.version ]
|
495
273
|
end
|
496
274
|
end
|
497
275
|
|
498
|
-
# A cousin of package_name_array, return a list of the architectures
|
499
|
-
# defined in the resource.
|
500
276
|
def safe_arch_array
|
501
277
|
if new_resource.arch.is_a?(Array)
|
502
278
|
new_resource.arch
|
@@ -507,13 +283,6 @@ class Chef
|
|
507
283
|
end
|
508
284
|
end
|
509
285
|
|
510
|
-
def flush_cache
|
511
|
-
if new_resource.respond_to?("flush_cache")
|
512
|
-
new_resource.flush_cache
|
513
|
-
else
|
514
|
-
{ before: false, after: false }
|
515
|
-
end
|
516
|
-
end
|
517
286
|
end
|
518
287
|
end
|
519
288
|
end
|