chef 12.18.31-universal-mingw32 → 12.19.33-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -27,7 +27,7 @@ describe Chef::Provider::Package::Solaris do
|
|
27
27
|
@new_resource.source("/tmp/bash.pkg")
|
28
28
|
|
29
29
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
30
|
-
allow(::File).to receive(:
|
30
|
+
allow(::File).to receive(:exist?).and_return(true)
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "assessing the current package status" do
|
@@ -63,7 +63,7 @@ PKGINFO
|
|
63
63
|
|
64
64
|
it "should raise an exception if a source is supplied but not found" do
|
65
65
|
allow(@provider).to receive(:shell_out).and_return(@status)
|
66
|
-
allow(::File).to receive(:
|
66
|
+
allow(::File).to receive(:exist?).and_return(false)
|
67
67
|
@provider.load_current_resource
|
68
68
|
@provider.define_resource_requirements
|
69
69
|
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Package)
|
@@ -71,8 +71,8 @@ PKGINFO
|
|
71
71
|
|
72
72
|
it "should get the source package version from pkginfo if provided" do
|
73
73
|
status = double(:stdout => @pkginfo, :exitstatus => 0)
|
74
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l -d /tmp/bash.pkg SUNWbash", { timeout: 900 }).and_return(status)
|
75
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash", { timeout: 900 }).and_return(@status)
|
74
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "-d", "/tmp/bash.pkg", "SUNWbash", { timeout: 900 }).and_return(status)
|
75
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "SUNWbash", { timeout: 900 }).and_return(@status)
|
76
76
|
@provider.load_current_resource
|
77
77
|
|
78
78
|
expect(@provider.current_resource.package_name).to eq("SUNWbash")
|
@@ -81,8 +81,8 @@ PKGINFO
|
|
81
81
|
|
82
82
|
it "should return the current version installed if found by pkginfo" do
|
83
83
|
status = double(:stdout => @pkginfo, :exitstatus => 0)
|
84
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l -d /tmp/bash.pkg SUNWbash", { timeout: 900 }).and_return(@status)
|
85
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash", { timeout: 900 }).and_return(status)
|
84
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "-d", "/tmp/bash.pkg", "SUNWbash", { timeout: 900 }).and_return(@status)
|
85
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "SUNWbash", { timeout: 900 }).and_return(status)
|
86
86
|
@provider.load_current_resource
|
87
87
|
expect(@provider.current_resource.version).to eq("11.10.0,REV=2005.01.08.05.16")
|
88
88
|
end
|
@@ -101,8 +101,8 @@ PKGINFO
|
|
101
101
|
end
|
102
102
|
|
103
103
|
it "should return a current resource with a nil version if the package is not found" do
|
104
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l -d /tmp/bash.pkg SUNWbash", { timeout: 900 }).and_return(@status)
|
105
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash", { timeout: 900 }).and_return(@status)
|
104
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "-d", "/tmp/bash.pkg", "SUNWbash", { timeout: 900 }).and_return(@status)
|
105
|
+
expect(@provider).to receive(:shell_out).with("pkginfo", "-l", "SUNWbash", { timeout: 900 }).and_return(@status)
|
106
106
|
@provider.load_current_resource
|
107
107
|
expect(@provider.current_resource.version).to be_nil
|
108
108
|
end
|
@@ -132,7 +132,7 @@ PKGINFO
|
|
132
132
|
|
133
133
|
describe "install and upgrade" do
|
134
134
|
it "should run pkgadd -n -d with the package source to install" do
|
135
|
-
expect(@provider).to receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all", { timeout: 900 })
|
135
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd", "-n", "-d", "/tmp/bash.pkg", "all", { timeout: 900 })
|
136
136
|
@provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
137
137
|
end
|
138
138
|
|
@@ -140,26 +140,26 @@ PKGINFO
|
|
140
140
|
@new_resource = Chef::Resource::Package.new("/tmp/bash.pkg")
|
141
141
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
142
142
|
expect(@new_resource.source).to eq("/tmp/bash.pkg")
|
143
|
-
expect(@provider).to receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all", { timeout: 900 })
|
143
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd", "-n", "-d", "/tmp/bash.pkg", "all", { timeout: 900 })
|
144
144
|
@provider.install_package("/tmp/bash.pkg", "11.10.0,REV=2005.01.08.05.16")
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should run pkgadd -n -a /tmp/myadmin -d with the package options -a /tmp/myadmin" do
|
148
|
-
|
149
|
-
expect(@provider).to receive(:shell_out!).with("pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all", { timeout: 900 })
|
148
|
+
@new_resource.options "-a /tmp/myadmin"
|
149
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd", "-n", "-a", "/tmp/myadmin", "-d", "/tmp/bash.pkg", "all", { timeout: 900 })
|
150
150
|
@provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
describe "remove" do
|
155
155
|
it "should run pkgrm -n to remove the package" do
|
156
|
-
expect(@provider).to receive(:shell_out!).with("pkgrm -n SUNWbash", { timeout: 900 })
|
156
|
+
expect(@provider).to receive(:shell_out!).with("pkgrm", "-n", "SUNWbash", { timeout: 900 })
|
157
157
|
@provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should run pkgrm -n -a /tmp/myadmin with options -a /tmp/myadmin" do
|
161
|
-
|
162
|
-
expect(@provider).to receive(:shell_out!).with("pkgrm -n -a /tmp/myadmin SUNWbash", { timeout: 900 })
|
161
|
+
@new_resource.options "-a /tmp/myadmin"
|
162
|
+
expect(@provider).to receive(:shell_out!).with("pkgrm", "-n", "-a", "/tmp/myadmin", "SUNWbash", { timeout: 900 })
|
163
163
|
@provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
164
164
|
end
|
165
165
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2017, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -312,6 +312,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
|
|
312
312
|
let(:resource_source) { "https://foo.bar/calculator.exe" }
|
313
313
|
|
314
314
|
it "downloads the http resource" do
|
315
|
+
allow(File).to receive(:exist?).with('c:\cache\calculator.exe').and_return(false)
|
315
316
|
expect(provider).to receive(:download_source_file)
|
316
317
|
provider.run_action(:install)
|
317
318
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-2017, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -40,6 +40,7 @@ describe Chef::Provider::Package::Yum do
|
|
40
40
|
)
|
41
41
|
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
42
42
|
allow(@yum_cache).to receive(:yum_binary=).with("yum")
|
43
|
+
allow(::File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false)
|
43
44
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
44
45
|
@pid = double("PID")
|
45
46
|
end
|
@@ -80,12 +81,13 @@ describe Chef::Provider::Package::Yum do
|
|
80
81
|
@new_resource = Chef::Resource::YumPackage.new("testing.source")
|
81
82
|
@new_resource.source "chef-server-core-12.0.5-1.rpm"
|
82
83
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
83
|
-
allow(File).to receive(:
|
84
|
+
allow(File).to receive(:exist?).with(@new_resource.source).and_return(true)
|
84
85
|
allow(@yum_cache).to receive(:installed_version).and_return(nil)
|
85
|
-
shellout_double = double(:stdout => "chef-server-core 12.0.5-1")
|
86
|
+
shellout_double = double(:stdout => "chef-server-core 12.0.5-1 i386")
|
86
87
|
allow(@provider).to receive(:shell_out!).and_return(shellout_double)
|
87
88
|
@provider.load_current_resource
|
88
89
|
expect(@provider.candidate_version).to eql("12.0.5-1")
|
90
|
+
expect(@provider.new_resource.arch).to eql("i386")
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
@@ -94,14 +96,14 @@ describe Chef::Provider::Package::Yum do
|
|
94
96
|
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(true)
|
95
97
|
expect(@yum_cache).to receive(:yum_binary=).with("yum-deprecated")
|
96
98
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
97
|
-
expect(@provider.yum_binary).to eql("yum-deprecated")
|
99
|
+
expect(@provider.send(:yum_binary)).to eql("yum-deprecated")
|
98
100
|
end
|
99
101
|
|
100
102
|
it "when yum-deprecated does not exist" do
|
101
103
|
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false)
|
102
104
|
expect(@yum_cache).to receive(:yum_binary=).with("yum")
|
103
105
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
104
|
-
expect(@provider.yum_binary).to eql("yum")
|
106
|
+
expect(@provider.send(:yum_binary)).to eql("yum")
|
105
107
|
end
|
106
108
|
|
107
109
|
it "when the yum_binary is set on the resource" do
|
@@ -109,23 +111,23 @@ describe Chef::Provider::Package::Yum do
|
|
109
111
|
expect(File).not_to receive(:exist?)
|
110
112
|
expect(@yum_cache).to receive(:yum_binary=).with("/usr/bin/yum-something")
|
111
113
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
112
|
-
expect(@provider.yum_binary).to eql("/usr/bin/yum-something")
|
114
|
+
expect(@provider.send(:yum_binary)).to eql("/usr/bin/yum-something")
|
113
115
|
end
|
114
116
|
|
115
117
|
it "when the new_resource is a vanilla package class and yum-deprecated exists" do
|
116
|
-
@new_resource = Chef::Resource::
|
118
|
+
@new_resource = Chef::Resource::YumPackage.new("cups")
|
117
119
|
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(true)
|
118
120
|
expect(@yum_cache).to receive(:yum_binary=).with("yum-deprecated")
|
119
121
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
120
|
-
expect(@provider.yum_binary).to eql("yum-deprecated")
|
122
|
+
expect(@provider.send(:yum_binary)).to eql("yum-deprecated")
|
121
123
|
end
|
122
124
|
|
123
125
|
it "when the new_resource is a vanilla package class and yum-deprecated does not exist" do
|
124
|
-
@new_resource = Chef::Resource::
|
126
|
+
@new_resource = Chef::Resource::YumPackage.new("cups")
|
125
127
|
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false)
|
126
128
|
expect(@yum_cache).to receive(:yum_binary=).with("yum")
|
127
129
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
128
|
-
expect(@provider.yum_binary).to eql("yum")
|
130
|
+
expect(@provider.send(:yum_binary)).to eql("yum")
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
@@ -155,19 +157,17 @@ describe Chef::Provider::Package::Yum do
|
|
155
157
|
@provider.load_current_resource
|
156
158
|
expect(@provider.new_resource.package_name).to eq("testing")
|
157
159
|
expect(@provider.new_resource.arch).to eq("noarch")
|
158
|
-
expect(@provider.arch).to eq("noarch")
|
159
160
|
|
160
161
|
@new_resource = Chef::Resource::YumPackage.new("testing.more.noarch")
|
161
162
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
162
163
|
@provider.load_current_resource
|
163
164
|
expect(@provider.new_resource.package_name).to eq("testing.more")
|
164
165
|
expect(@provider.new_resource.arch).to eq("noarch")
|
165
|
-
expect(@provider.arch).to eq("noarch")
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "when version constraint in package_name" do
|
169
169
|
it "should set package_version if no existing package_name is found and new_package_name is available" do
|
170
|
-
@new_resource = Chef::Resource::
|
170
|
+
@new_resource = Chef::Resource::YumPackage.new("cups = 1.2.4-11.18.el5_2.3")
|
171
171
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
172
172
|
allow(@yum_cache).to receive(:package_available?) { |pkg| pkg == "cups" ? true : false }
|
173
173
|
allow(@yum_cache).to receive(:packages_from_require) do |pkg|
|
@@ -211,14 +211,12 @@ describe Chef::Provider::Package::Yum do
|
|
211
211
|
@provider.load_current_resource
|
212
212
|
expect(@provider.new_resource.package_name).to eq("testing.beta3")
|
213
213
|
expect(@provider.new_resource.arch).to eq(nil)
|
214
|
-
expect(@provider.arch).to eq(nil)
|
215
214
|
|
216
215
|
@new_resource = Chef::Resource::YumPackage.new("testing.beta3.more")
|
217
216
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
218
217
|
@provider.load_current_resource
|
219
218
|
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
|
220
219
|
expect(@provider.new_resource.arch).to eq(nil)
|
221
|
-
expect(@provider.arch).to eq(nil)
|
222
220
|
end
|
223
221
|
|
224
222
|
it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do
|
@@ -242,14 +240,12 @@ describe Chef::Provider::Package::Yum do
|
|
242
240
|
@provider.load_current_resource
|
243
241
|
expect(@provider.new_resource.package_name).to eq("testing.beta3")
|
244
242
|
expect(@provider.new_resource.arch).to eq(nil)
|
245
|
-
expect(@provider.arch).to eq(nil)
|
246
243
|
|
247
244
|
@new_resource = Chef::Resource::YumPackage.new("testing.beta3.more")
|
248
245
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
249
246
|
@provider.load_current_resource
|
250
247
|
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
|
251
248
|
expect(@provider.new_resource.arch).to eq(nil)
|
252
|
-
expect(@provider.arch).to eq(nil)
|
253
249
|
end
|
254
250
|
|
255
251
|
it "should ensure it doesn't clobber an existing arch if passed" do
|
@@ -539,8 +535,8 @@ describe Chef::Provider::Package::Yum do
|
|
539
535
|
end
|
540
536
|
|
541
537
|
it "should run yum localinstall if given a path to an rpm as the package" do
|
542
|
-
@new_resource = Chef::Resource::
|
543
|
-
allow(::File).to receive(:
|
538
|
+
@new_resource = Chef::Resource::YumPackage.new("/tmp/emacs-21.4-20.el5.i386.rpm")
|
539
|
+
allow(::File).to receive(:exist?).with("/tmp/emacs-21.4-20.el5.i386.rpm").and_return(true)
|
544
540
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
545
541
|
expect(@new_resource.source).to eq("/tmp/emacs-21.4-20.el5.i386.rpm")
|
546
542
|
expect(@provider).to receive(:yum_command).with(
|
@@ -550,9 +546,9 @@ describe Chef::Provider::Package::Yum do
|
|
550
546
|
end
|
551
547
|
|
552
548
|
it "should run yum install with the package name, version and arch" do
|
553
|
-
@provider.load_current_resource
|
554
549
|
allow(@new_resource).to receive(:arch).and_return("i386")
|
555
550
|
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
551
|
+
@provider.load_current_resource
|
556
552
|
expect(@provider).to receive(:yum_command).with(
|
557
553
|
"-d0 -e0 -y install cups-1.2.4-11.19.el5.i386"
|
558
554
|
)
|
@@ -690,7 +686,7 @@ describe Chef::Provider::Package::Yum do
|
|
690
686
|
|
691
687
|
it "should run yum install if the package is not installed" do
|
692
688
|
@provider.load_current_resource
|
693
|
-
@current_resource = Chef::Resource::
|
689
|
+
@current_resource = Chef::Resource::YumPackage.new("cups")
|
694
690
|
allow(@provider).to receive(:candidate_version).and_return("11")
|
695
691
|
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
696
692
|
expect(@provider).to receive(:yum_command).with(
|
@@ -721,18 +717,15 @@ describe Chef::Provider::Package::Yum do
|
|
721
717
|
# Test our little workaround, some crossover into Chef::Provider::Package territory
|
722
718
|
it "should call action_upgrade in the parent if the current resource version is nil" do
|
723
719
|
allow(@yum_cache).to receive(:installed_version).and_return(nil)
|
724
|
-
@current_resource = Chef::Resource::
|
720
|
+
@current_resource = Chef::Resource::YumPackage.new("cups")
|
725
721
|
allow(@provider).to receive(:candidate_version).and_return("11")
|
726
|
-
expect(@provider).to receive(:upgrade_package).with(
|
727
|
-
"cups",
|
728
|
-
"11"
|
729
|
-
)
|
722
|
+
expect(@provider).to receive(:upgrade_package).with(["cups"], ["11"])
|
730
723
|
@provider.run_action(:upgrade)
|
731
724
|
end
|
732
725
|
|
733
726
|
it "should call action_upgrade in the parent if the candidate version is nil" do
|
734
727
|
@provider.load_current_resource
|
735
|
-
@current_resource = Chef::Resource::
|
728
|
+
@current_resource = Chef::Resource::YumPackage.new("cups")
|
736
729
|
allow(@provider).to receive(:candidate_version).and_return(nil)
|
737
730
|
expect(@provider).not_to receive(:upgrade_package)
|
738
731
|
@provider.run_action(:upgrade)
|
@@ -740,19 +733,16 @@ describe Chef::Provider::Package::Yum do
|
|
740
733
|
|
741
734
|
it "should call action_upgrade in the parent if the candidate is newer" do
|
742
735
|
@provider.load_current_resource
|
743
|
-
@current_resource = Chef::Resource::
|
736
|
+
@current_resource = Chef::Resource::YumPackage.new("cups")
|
744
737
|
allow(@provider).to receive(:candidate_version).and_return("11")
|
745
|
-
expect(@provider).to receive(:upgrade_package).with(
|
746
|
-
"cups",
|
747
|
-
"11"
|
748
|
-
)
|
738
|
+
expect(@provider).to receive(:upgrade_package).with(["cups"], ["11"])
|
749
739
|
@provider.run_action(:upgrade)
|
750
740
|
end
|
751
741
|
|
752
742
|
it "should not call action_upgrade in the parent if the candidate is older" do
|
753
743
|
allow(@yum_cache).to receive(:installed_version).and_return("12")
|
754
744
|
@provider.load_current_resource
|
755
|
-
@current_resource = Chef::Resource::
|
745
|
+
@current_resource = Chef::Resource::YumPackage.new("cups")
|
756
746
|
allow(@provider).to receive(:candidate_version).and_return("11")
|
757
747
|
expect(@provider).not_to receive(:upgrade_package)
|
758
748
|
@provider.run_action(:upgrade)
|
@@ -811,7 +801,7 @@ describe Chef::Provider::Package::Yum do
|
|
811
801
|
"yum -d0 -e0 -y install emacs-1.0",
|
812
802
|
{ :timeout => Chef::Config[:yum_timeout] }
|
813
803
|
)
|
814
|
-
@provider.yum_command
|
804
|
+
@provider.send(:yum_command, "-d0 -e0 -y install emacs-1.0")
|
815
805
|
end
|
816
806
|
|
817
807
|
it "should run yum once if it exits with a return code > 0 and no scriptlet failures" do
|
@@ -821,7 +811,7 @@ describe Chef::Provider::Package::Yum do
|
|
821
811
|
"yum -d0 -e0 -y install emacs-1.0",
|
822
812
|
{ :timeout => Chef::Config[:yum_timeout] }
|
823
813
|
)
|
824
|
-
expect { @provider.yum_command
|
814
|
+
expect { @provider.send(:yum_command, "-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
825
815
|
end
|
826
816
|
|
827
817
|
it "should run yum once if it exits with a return code of 1 and %pre scriptlet failures" do
|
@@ -833,7 +823,7 @@ describe Chef::Provider::Package::Yum do
|
|
833
823
|
{ :timeout => Chef::Config[:yum_timeout] }
|
834
824
|
)
|
835
825
|
# will still raise an exception, can't stub out the subsequent call
|
836
|
-
expect { @provider.yum_command
|
826
|
+
expect { @provider.send(:yum_command, "-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
837
827
|
end
|
838
828
|
|
839
829
|
it "should run yum twice if it exits with a return code of 1 and %post scriptlet failures" do
|
@@ -845,7 +835,7 @@ describe Chef::Provider::Package::Yum do
|
|
845
835
|
{ :timeout => Chef::Config[:yum_timeout] }
|
846
836
|
)
|
847
837
|
# will still raise an exception, can't stub out the subsequent call
|
848
|
-
expect { @provider.yum_command
|
838
|
+
expect { @provider.send(:yum_command, "-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
849
839
|
end
|
850
840
|
|
851
841
|
it "should pass the yum_binary to the command if its specified" do
|
@@ -858,7 +848,7 @@ describe Chef::Provider::Package::Yum do
|
|
858
848
|
"yum-deprecated -d0 -e0 -y install emacs-1.0",
|
859
849
|
{ :timeout => Chef::Config[:yum_timeout] }
|
860
850
|
)
|
861
|
-
@provider.yum_command
|
851
|
+
@provider.send(:yum_command, "-d0 -e0 -y install emacs-1.0")
|
862
852
|
end
|
863
853
|
end
|
864
854
|
end
|
@@ -2132,7 +2122,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2132
2122
|
@node = Chef::Node.new
|
2133
2123
|
@events = Chef::EventDispatch::Dispatcher.new
|
2134
2124
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
2135
|
-
@new_resource = Chef::Resource::
|
2125
|
+
@new_resource = Chef::Resource::YumPackage.new(%w{cups vim})
|
2136
2126
|
@status = double("Status", :exitstatus => 0)
|
2137
2127
|
@yum_cache = double(
|
2138
2128
|
"Chef::Provider::Yum::YumCache",
|
@@ -2153,6 +2143,14 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2153
2143
|
@pid = double("PID")
|
2154
2144
|
end
|
2155
2145
|
|
2146
|
+
describe "when evaluating the correctness of the resource" do
|
2147
|
+
it "raises an error if the array lengths of package name, arch, and version do not match up" do
|
2148
|
+
allow(@new_resource).to receive(:version).and_return(["1.1"])
|
2149
|
+
allow(@new_resource).to receive(:arch).and_return(%w{x86_64 i386 i686})
|
2150
|
+
expect { @provider.check_resource_semantics! }.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
|
2151
|
+
end
|
2152
|
+
end
|
2153
|
+
|
2156
2154
|
describe "when loading the current system state" do
|
2157
2155
|
it "should create a current resource with the name of the new_resource" do
|
2158
2156
|
@provider.load_current_resource
|
@@ -2194,7 +2192,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2194
2192
|
|
2195
2193
|
describe "when version constraint in package_name" do
|
2196
2194
|
it "should set package_version if no existing package_name is found and new_package_name is available" do
|
2197
|
-
@new_resource = Chef::Resource::
|
2195
|
+
@new_resource = Chef::Resource::YumPackage.new(["cups = 1.2.4-11.18.el5_2.3", "emacs = 24.4"])
|
2198
2196
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
2199
2197
|
allow(@yum_cache).to receive(:package_available?) { |pkg| %w{cups emacs}.include?(pkg) ? true : false }
|
2200
2198
|
allow(@yum_cache).to receive(:candidate_version) do |pkg|
|
@@ -2212,7 +2210,8 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2212
2210
|
end
|
2213
2211
|
end
|
2214
2212
|
expect(Chef::Log).to receive(:debug).exactly(2).times.with(%r{matched 1 package,})
|
2215
|
-
expect(Chef::Log).to receive(:debug).exactly(1).times.with(%r{candidate version:
|
2213
|
+
expect(Chef::Log).to receive(:debug).exactly(1).times.with(%r{candidate version: 1.2.4-11.18.el5_2.3})
|
2214
|
+
expect(Chef::Log).to receive(:debug).exactly(1).times.with(%r{candidate version: 24.4})
|
2216
2215
|
expect(Chef::Log).to receive(:debug).at_least(2).times.with(%r{checking yum info})
|
2217
2216
|
@provider.load_current_resource
|
2218
2217
|
expect(@provider.new_resource.package_name).to eq(%w{cups emacs})
|
@@ -2235,9 +2234,18 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2235
2234
|
@provider.install_package(%w{cups vim}, ["1.2.4-11.19.el5", "1.0"])
|
2236
2235
|
end
|
2237
2236
|
|
2237
|
+
it "should not run yum install with nil package name" do
|
2238
|
+
@provider.load_current_resource
|
2239
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
2240
|
+
expect(@provider).to receive(:yum_command).with(
|
2241
|
+
"-d0 -e0 -y install cups-1.2.4-11.19.el5"
|
2242
|
+
)
|
2243
|
+
@provider.install_package(["cups", nil], ["1.2.4-11.19.el5", nil])
|
2244
|
+
end
|
2245
|
+
|
2238
2246
|
it "should run yum install with the package name, version and arch" do
|
2239
2247
|
@provider.load_current_resource
|
2240
|
-
allow(@new_resource).to receive(:arch).and_return(
|
2248
|
+
allow(@new_resource).to receive(:arch).and_return(%w{i386 i386})
|
2241
2249
|
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
2242
2250
|
expect(@provider).to receive(:yum_command).with(
|
2243
2251
|
"-d0 -e0 -y install cups-1.2.4-11.19.el5.i386 vim-1.0.i386"
|
@@ -2258,7 +2266,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
|
|
2258
2266
|
end
|
2259
2267
|
|
2260
2268
|
it "should run yum install with the package name and version when name has arch" do
|
2261
|
-
@new_resource = Chef::Resource::
|
2269
|
+
@new_resource = Chef::Resource::YumPackage.new(["cups.x86_64", "vim"])
|
2262
2270
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
2263
2271
|
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
2264
2272
|
|
@@ -38,14 +38,14 @@ describe Chef::Provider::Package::Zypper do
|
|
38
38
|
allow(provider).to receive(:`).and_return("2.0")
|
39
39
|
end
|
40
40
|
|
41
|
-
def shell_out_expectation(command, options
|
42
|
-
options ||=
|
43
|
-
expect(provider).to receive(:shell_out).with(command, options)
|
41
|
+
def shell_out_expectation(*command, **options)
|
42
|
+
options[:timeout] ||= 900
|
43
|
+
expect(provider).to receive(:shell_out).with(*command, **options)
|
44
44
|
end
|
45
45
|
|
46
|
-
def shell_out_expectation!(command, options
|
47
|
-
options ||=
|
48
|
-
expect(provider).to receive(:shell_out!).with(command, options)
|
46
|
+
def shell_out_expectation!(*command, **options)
|
47
|
+
options[:timeout] ||= 900
|
48
|
+
expect(provider).to receive(:shell_out!).with(*command, **options)
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "when loading the current package state" do
|
@@ -61,7 +61,7 @@ describe Chef::Provider::Package::Zypper do
|
|
61
61
|
|
62
62
|
it "should run zypper info with the package name" do
|
63
63
|
shell_out_expectation!(
|
64
|
-
"zypper --non-interactive info
|
64
|
+
"zypper", "--non-interactive", "info", new_resource.package_name
|
65
65
|
).and_return(status)
|
66
66
|
provider.load_current_resource
|
67
67
|
end
|
@@ -113,14 +113,14 @@ describe Chef::Provider::Package::Zypper do
|
|
113
113
|
it "should run zypper install with the package name and version" do
|
114
114
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
115
115
|
shell_out_expectation!(
|
116
|
-
"zypper --non-interactive install --auto-agree-with-licenses emacs=1.0"
|
116
|
+
"zypper", "--non-interactive", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
117
117
|
)
|
118
118
|
provider.install_package(["emacs"], ["1.0"])
|
119
119
|
end
|
120
120
|
it "should run zypper install without gpg checks" do
|
121
121
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
122
122
|
shell_out_expectation!(
|
123
|
-
"zypper --non-interactive --no-gpg-checks install
|
123
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
124
124
|
)
|
125
125
|
provider.install_package(["emacs"], ["1.0"])
|
126
126
|
end
|
@@ -129,7 +129,7 @@ describe Chef::Provider::Package::Zypper do
|
|
129
129
|
/All packages will be installed without gpg signature checks/
|
130
130
|
)
|
131
131
|
shell_out_expectation!(
|
132
|
-
"zypper --non-interactive --no-gpg-checks install
|
132
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
133
133
|
)
|
134
134
|
provider.install_package(["emacs"], ["1.0"])
|
135
135
|
end
|
@@ -139,14 +139,14 @@ describe Chef::Provider::Package::Zypper do
|
|
139
139
|
it "should run zypper update with the package name and version" do
|
140
140
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
141
141
|
shell_out_expectation!(
|
142
|
-
"zypper --non-interactive install --auto-agree-with-licenses emacs=1.0"
|
142
|
+
"zypper", "--non-interactive", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
143
143
|
)
|
144
144
|
provider.upgrade_package(["emacs"], ["1.0"])
|
145
145
|
end
|
146
146
|
it "should run zypper update without gpg checks" do
|
147
147
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
148
148
|
shell_out_expectation!(
|
149
|
-
"zypper --non-interactive --no-gpg-checks install
|
149
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
150
150
|
)
|
151
151
|
provider.upgrade_package(["emacs"], ["1.0"])
|
152
152
|
end
|
@@ -155,13 +155,13 @@ describe Chef::Provider::Package::Zypper do
|
|
155
155
|
/All packages will be installed without gpg signature checks/
|
156
156
|
)
|
157
157
|
shell_out_expectation!(
|
158
|
-
"zypper --non-interactive --no-gpg-checks install
|
158
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
159
159
|
)
|
160
160
|
provider.upgrade_package(["emacs"], ["1.0"])
|
161
161
|
end
|
162
162
|
it "should run zypper upgrade without gpg checks" do
|
163
163
|
shell_out_expectation!(
|
164
|
-
"zypper --non-interactive --no-gpg-checks install
|
164
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0"
|
165
165
|
)
|
166
166
|
provider.upgrade_package(["emacs"], ["1.0"])
|
167
167
|
end
|
@@ -173,7 +173,7 @@ describe Chef::Provider::Package::Zypper do
|
|
173
173
|
it "should run zypper remove with the package name" do
|
174
174
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
175
175
|
shell_out_expectation!(
|
176
|
-
"zypper --non-interactive remove emacs"
|
176
|
+
"zypper", "--non-interactive", "remove", "emacs"
|
177
177
|
)
|
178
178
|
provider.remove_package(["emacs"], [nil])
|
179
179
|
end
|
@@ -183,14 +183,14 @@ describe Chef::Provider::Package::Zypper do
|
|
183
183
|
it "should run zypper remove with the package name" do
|
184
184
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
185
185
|
shell_out_expectation!(
|
186
|
-
"zypper --non-interactive remove emacs=1.0"
|
186
|
+
"zypper", "--non-interactive", "remove", "emacs=1.0"
|
187
187
|
)
|
188
188
|
provider.remove_package(["emacs"], ["1.0"])
|
189
189
|
end
|
190
190
|
it "should run zypper remove without gpg checks" do
|
191
191
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
192
192
|
shell_out_expectation!(
|
193
|
-
"zypper --non-interactive --no-gpg-checks remove emacs=1.0"
|
193
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "emacs=1.0"
|
194
194
|
)
|
195
195
|
provider.remove_package(["emacs"], ["1.0"])
|
196
196
|
end
|
@@ -199,7 +199,7 @@ describe Chef::Provider::Package::Zypper do
|
|
199
199
|
/All packages will be installed without gpg signature checks/
|
200
200
|
)
|
201
201
|
shell_out_expectation!(
|
202
|
-
"zypper --non-interactive --no-gpg-checks remove emacs=1.0"
|
202
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "emacs=1.0"
|
203
203
|
)
|
204
204
|
provider.remove_package(["emacs"], ["1.0"])
|
205
205
|
end
|
@@ -209,14 +209,14 @@ describe Chef::Provider::Package::Zypper do
|
|
209
209
|
describe "purge_package" do
|
210
210
|
it "should run remove with the name and version and --clean-deps" do
|
211
211
|
shell_out_expectation!(
|
212
|
-
"zypper --non-interactive --no-gpg-checks remove --clean-deps emacs=1.0"
|
212
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "--clean-deps", "emacs=1.0"
|
213
213
|
)
|
214
214
|
provider.purge_package(["emacs"], ["1.0"])
|
215
215
|
end
|
216
216
|
it "should run zypper purge without gpg checks" do
|
217
217
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
218
218
|
shell_out_expectation!(
|
219
|
-
"zypper --non-interactive --no-gpg-checks remove --clean-deps emacs=1.0"
|
219
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "--clean-deps", "emacs=1.0"
|
220
220
|
)
|
221
221
|
provider.purge_package(["emacs"], ["1.0"])
|
222
222
|
end
|
@@ -225,7 +225,7 @@ describe Chef::Provider::Package::Zypper do
|
|
225
225
|
/All packages will be installed without gpg signature checks/
|
226
226
|
)
|
227
227
|
shell_out_expectation!(
|
228
|
-
"zypper --non-interactive --no-gpg-checks remove --clean-deps emacs=1.0"
|
228
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "--clean-deps", "emacs=1.0"
|
229
229
|
)
|
230
230
|
provider.purge_package(["emacs"], ["1.0"])
|
231
231
|
end
|
@@ -235,14 +235,14 @@ describe Chef::Provider::Package::Zypper do
|
|
235
235
|
it "should run zypper addlock with the package name" do
|
236
236
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
237
237
|
shell_out_expectation!(
|
238
|
-
"zypper --non-interactive addlock emacs"
|
238
|
+
"zypper", "--non-interactive", "addlock", "emacs"
|
239
239
|
)
|
240
240
|
provider.lock_package(["emacs"], [nil])
|
241
241
|
end
|
242
242
|
it "should run zypper addlock without gpg checks" do
|
243
243
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
244
244
|
shell_out_expectation!(
|
245
|
-
"zypper --non-interactive --no-gpg-checks addlock emacs"
|
245
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "addlock", "emacs"
|
246
246
|
)
|
247
247
|
provider.lock_package(["emacs"], [nil])
|
248
248
|
end
|
@@ -251,13 +251,13 @@ describe Chef::Provider::Package::Zypper do
|
|
251
251
|
/All packages will be installed without gpg signature checks/
|
252
252
|
)
|
253
253
|
shell_out_expectation!(
|
254
|
-
"zypper --non-interactive --no-gpg-checks addlock emacs"
|
254
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "addlock", "emacs"
|
255
255
|
)
|
256
256
|
provider.lock_package(["emacs"], [nil])
|
257
257
|
end
|
258
258
|
it "should run zypper addlock without gpg checks" do
|
259
259
|
shell_out_expectation!(
|
260
|
-
"zypper --non-interactive --no-gpg-checks addlock emacs"
|
260
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "addlock", "emacs"
|
261
261
|
)
|
262
262
|
provider.lock_package(["emacs"], [nil])
|
263
263
|
end
|
@@ -267,14 +267,14 @@ describe Chef::Provider::Package::Zypper do
|
|
267
267
|
it "should run zypper removelock with the package name" do
|
268
268
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(true)
|
269
269
|
shell_out_expectation!(
|
270
|
-
"zypper --non-interactive removelock emacs"
|
270
|
+
"zypper", "--non-interactive", "removelock", "emacs"
|
271
271
|
)
|
272
272
|
provider.unlock_package(["emacs"], [nil])
|
273
273
|
end
|
274
274
|
it "should run zypper removelock without gpg checks" do
|
275
275
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
276
276
|
shell_out_expectation!(
|
277
|
-
"zypper --non-interactive --no-gpg-checks removelock emacs"
|
277
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "removelock", "emacs"
|
278
278
|
)
|
279
279
|
provider.unlock_package(["emacs"], [nil])
|
280
280
|
end
|
@@ -283,13 +283,13 @@ describe Chef::Provider::Package::Zypper do
|
|
283
283
|
/All packages will be installed without gpg signature checks/
|
284
284
|
)
|
285
285
|
shell_out_expectation!(
|
286
|
-
"zypper --non-interactive --no-gpg-checks removelock emacs"
|
286
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "removelock", "emacs"
|
287
287
|
)
|
288
288
|
provider.unlock_package(["emacs"], [nil])
|
289
289
|
end
|
290
290
|
it "should run zypper removelock without gpg checks" do
|
291
291
|
shell_out_expectation!(
|
292
|
-
"zypper --non-interactive --no-gpg-checks removelock emacs"
|
292
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "removelock", "emacs"
|
293
293
|
)
|
294
294
|
provider.unlock_package(["emacs"], [nil])
|
295
295
|
end
|
@@ -303,7 +303,7 @@ describe Chef::Provider::Package::Zypper do
|
|
303
303
|
describe "install_package" do
|
304
304
|
it "should run zypper install with the package name and version" do
|
305
305
|
shell_out_expectation!(
|
306
|
-
"zypper --no-gpg-checks install --auto-agree-with-licenses -y emacs"
|
306
|
+
"zypper", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "-y", "emacs"
|
307
307
|
)
|
308
308
|
provider.install_package(["emacs"], ["1.0"])
|
309
309
|
end
|
@@ -312,7 +312,7 @@ describe Chef::Provider::Package::Zypper do
|
|
312
312
|
describe "upgrade_package" do
|
313
313
|
it "should run zypper update with the package name and version" do
|
314
314
|
shell_out_expectation!(
|
315
|
-
"zypper --no-gpg-checks install --auto-agree-with-licenses -y emacs"
|
315
|
+
"zypper", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "-y", "emacs"
|
316
316
|
)
|
317
317
|
provider.upgrade_package(["emacs"], ["1.0"])
|
318
318
|
end
|
@@ -321,7 +321,7 @@ describe Chef::Provider::Package::Zypper do
|
|
321
321
|
describe "remove_package" do
|
322
322
|
it "should run zypper remove with the package name" do
|
323
323
|
shell_out_expectation!(
|
324
|
-
"zypper --no-gpg-checks remove -y emacs"
|
324
|
+
"zypper", "--no-gpg-checks", "remove", "-y", "emacs"
|
325
325
|
)
|
326
326
|
provider.remove_package(["emacs"], ["1.0"])
|
327
327
|
end
|
@@ -332,7 +332,7 @@ describe Chef::Provider::Package::Zypper do
|
|
332
332
|
it "should install an array of package names and versions" do
|
333
333
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
334
334
|
shell_out_expectation!(
|
335
|
-
"zypper --non-interactive --no-gpg-checks install
|
335
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "install", "--auto-agree-with-licenses", "emacs=1.0", "vim=2.0"
|
336
336
|
)
|
337
337
|
provider.install_package(%w{emacs vim}, ["1.0", "2.0"])
|
338
338
|
end
|
@@ -340,7 +340,7 @@ describe Chef::Provider::Package::Zypper do
|
|
340
340
|
it "should remove an array of package names and versions" do
|
341
341
|
allow(Chef::Config).to receive(:[]).with(:zypper_check_gpg).and_return(false)
|
342
342
|
shell_out_expectation!(
|
343
|
-
"zypper --non-interactive --no-gpg-checks remove emacs=1.0 vim=2.0"
|
343
|
+
"zypper", "--non-interactive", "--no-gpg-checks", "remove", "emacs=1.0", "vim=2.0"
|
344
344
|
)
|
345
345
|
provider.remove_package(%w{emacs vim}, ["1.0", "2.0"])
|
346
346
|
end
|