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
@@ -51,7 +51,7 @@ ERR
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should run pacman query with the package name" do
|
54
|
-
expect(@provider).to receive(:shell_out).with("pacman -Qi
|
54
|
+
expect(@provider).to receive(:shell_out).with("pacman", "-Qi", @new_resource.package_name, { timeout: 900 }).and_return(@status)
|
55
55
|
@provider.load_current_resource
|
56
56
|
end
|
57
57
|
|
@@ -121,7 +121,7 @@ Include = /etc/pacman.d/mirrorlist
|
|
121
121
|
PACMAN_CONF
|
122
122
|
|
123
123
|
status = double(:stdout => "customrepo nano 1.2.3-4", :exitstatus => 0)
|
124
|
-
allow(::File).to receive(:
|
124
|
+
allow(::File).to receive(:exist?).with("/etc/pacman.conf").and_return(true)
|
125
125
|
allow(::File).to receive(:read).with("/etc/pacman.conf").and_return(@pacman_conf)
|
126
126
|
allow(@provider).to receive(:shell_out).and_return(status)
|
127
127
|
|
@@ -151,12 +151,12 @@ PACMAN_CONF
|
|
151
151
|
|
152
152
|
describe Chef::Provider::Package::Pacman, "install_package" do
|
153
153
|
it "should run pacman install with the package name and version" do
|
154
|
-
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano", { timeout: 900 })
|
154
|
+
expect(@provider).to receive(:shell_out!).with("pacman", "--sync", "--noconfirm", "--noprogressbar", "nano", { timeout: 900 })
|
155
155
|
@provider.install_package("nano", "1.0")
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should run pacman install with the package name and version and options if specified" do
|
159
|
-
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano", { timeout: 900 })
|
159
|
+
expect(@provider).to receive(:shell_out!).with("pacman", "--sync", "--noconfirm", "--noprogressbar", "--debug", "nano", { timeout: 900 })
|
160
160
|
allow(@new_resource).to receive(:options).and_return("--debug")
|
161
161
|
|
162
162
|
@provider.install_package("nano", "1.0")
|
@@ -172,12 +172,12 @@ PACMAN_CONF
|
|
172
172
|
|
173
173
|
describe Chef::Provider::Package::Pacman, "remove_package" do
|
174
174
|
it "should run pacman remove with the package name" do
|
175
|
-
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano", { timeout: 900 })
|
175
|
+
expect(@provider).to receive(:shell_out!).with("pacman", "--remove", "--noconfirm", "--noprogressbar", "nano", { timeout: 900 })
|
176
176
|
@provider.remove_package("nano", "1.0")
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should run pacman remove with the package name and options if specified" do
|
180
|
-
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano", { timeout: 900 })
|
180
|
+
expect(@provider).to receive(:shell_out!).with("pacman", "--remove", "--noconfirm", "--noprogressbar", "--debug", "nano", { timeout: 900 })
|
181
181
|
allow(@new_resource).to receive(:options).and_return("--debug")
|
182
182
|
|
183
183
|
@provider.remove_package("nano", "1.0")
|
@@ -59,7 +59,7 @@ PKG_STATUS
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should run pkg info with the package name" do
|
62
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning print-ids -M none -m
|
62
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "print-ids", "-M", "none", "-m", @new_resource.package_name, "-f", "%c/%p %v %r\n").and_return(@shell_out)
|
63
63
|
@provider.load_current_resource
|
64
64
|
end
|
65
65
|
|
@@ -86,13 +86,13 @@ INSTALLED
|
|
86
86
|
|
87
87
|
context "when installing a package" do
|
88
88
|
it "should run pkg install with the package name and version" do
|
89
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x
|
89
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
|
90
90
|
@provider.install_package("net/ntp", "4.2.6_p5-r2")
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should run pkg install with the package name and version and options if specified" do
|
94
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x --preserve-world
|
95
|
-
|
94
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "resolve", "-x", "--preserve-world", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
|
95
|
+
@new_resource.options "--preserve-world"
|
96
96
|
@provider.install_package("net/ntp", "4.2.6_p5-r2")
|
97
97
|
end
|
98
98
|
|
@@ -101,7 +101,7 @@ INSTALLED
|
|
101
101
|
sys-process/lsof 4.87 arbor
|
102
102
|
sys-process/lsof 4.87 x86_64
|
103
103
|
PKG_STATUS
|
104
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x
|
104
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { :timeout => @new_resource.timeout || 900 })
|
105
105
|
@provider.install_package("sys-process/lsof", "4.87")
|
106
106
|
end
|
107
107
|
|
@@ -119,14 +119,14 @@ PKG_STATUS
|
|
119
119
|
|
120
120
|
context "when upgrading a package" do
|
121
121
|
it "should run pkg install with the package name and version" do
|
122
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x
|
122
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
|
123
123
|
@provider.upgrade_package("net/ntp", "4.2.6_p5-r2")
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
127
|
context "when uninstalling a package" do
|
128
128
|
it "should run pkg uninstall with the package name and version" do
|
129
|
-
expect(@provider).to receive(:shell_out!).with("cave -L warning uninstall -x
|
129
|
+
expect(@provider).to receive(:shell_out!).with("cave", "-L", "warning", "uninstall", "-x", "=net/ntp-4.2.6_p5-r2")
|
130
130
|
@provider.remove_package("net/ntp", "4.2.6_p5-r2")
|
131
131
|
end
|
132
132
|
|
@@ -284,31 +284,30 @@ EOF
|
|
284
284
|
|
285
285
|
describe Chef::Provider::Package::Portage, "install_package" do
|
286
286
|
it "should install a normally versioned package using portage" do
|
287
|
-
expect(@provider).to receive(:shell_out!).with("emerge -g --color n --nospinner --quiet =dev-util/git-1.0.0")
|
287
|
+
expect(@provider).to receive(:shell_out!).with("emerge", "-g", "--color", "n", "--nospinner", "--quiet", "=dev-util/git-1.0.0")
|
288
288
|
@provider.install_package("dev-util/git", "1.0.0")
|
289
289
|
end
|
290
290
|
|
291
291
|
it "should install a tilde versioned package using portage" do
|
292
|
-
expect(@provider).to receive(:shell_out!).with("emerge -g --color n --nospinner --quiet ~dev-util/git-1.0.0")
|
292
|
+
expect(@provider).to receive(:shell_out!).with("emerge", "-g", "--color", "n", "--nospinner", "--quiet", "~dev-util/git-1.0.0")
|
293
293
|
@provider.install_package("dev-util/git", "~1.0.0")
|
294
294
|
end
|
295
295
|
|
296
296
|
it "should add options to the emerge command when specified" do
|
297
|
-
expect(@provider).to receive(:shell_out!).with("emerge -g --color n --nospinner --quiet --oneshot =dev-util/git-1.0.0")
|
298
|
-
|
299
|
-
|
297
|
+
expect(@provider).to receive(:shell_out!).with("emerge", "-g", "--color", "n", "--nospinner", "--quiet", "--oneshot", "=dev-util/git-1.0.0")
|
298
|
+
@new_resource.options "--oneshot"
|
300
299
|
@provider.install_package("dev-util/git", "1.0.0")
|
301
300
|
end
|
302
301
|
end
|
303
302
|
|
304
303
|
describe Chef::Provider::Package::Portage, "remove_package" do
|
305
304
|
it "should un-emerge the package with no version specified" do
|
306
|
-
expect(@provider).to receive(:shell_out!).with("emerge --unmerge --color n --nospinner --quiet dev-util/git")
|
305
|
+
expect(@provider).to receive(:shell_out!).with("emerge", "--unmerge", "--color", "n", "--nospinner", "--quiet", "dev-util/git")
|
307
306
|
@provider.remove_package("dev-util/git", nil)
|
308
307
|
end
|
309
308
|
|
310
309
|
it "should un-emerge the package with a version specified" do
|
311
|
-
expect(@provider).to receive(:shell_out!).with("emerge --unmerge --color n --nospinner --quiet =dev-util/git-1.0.0")
|
310
|
+
expect(@provider).to receive(:shell_out!).with("emerge", "--unmerge", "--color", "n", "--nospinner", "--quiet", "=dev-util/git-1.0.0")
|
312
311
|
@provider.remove_package("dev-util/git", "1.0.0")
|
313
312
|
end
|
314
313
|
end
|
@@ -41,7 +41,7 @@ describe Chef::Provider::Package::Rpm do
|
|
41
41
|
let(:rpm_q_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) }
|
42
42
|
|
43
43
|
before(:each) do
|
44
|
-
allow(::File).to receive(:
|
44
|
+
allow(::File).to receive(:exist?).with("PLEASE STUB File.exists? EXACTLY").and_return(true)
|
45
45
|
|
46
46
|
# Ensure all shell out usage is stubbed with exact arguments
|
47
47
|
allow(provider).to receive(:shell_out!).with("PLEASE STUB YOUR SHELLOUT CALLS").and_return(nil)
|
@@ -61,7 +61,7 @@ describe Chef::Provider::Package::Rpm do
|
|
61
61
|
context "when the source is a file that doesn't exist" do
|
62
62
|
|
63
63
|
it "should raise an exception when attempting any action" do
|
64
|
-
allow(::File).to receive(:
|
64
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(false)
|
65
65
|
expect { provider.run_action(:any) }.to raise_error(Chef::Exceptions::Package)
|
66
66
|
end
|
67
67
|
end
|
@@ -71,7 +71,7 @@ describe Chef::Provider::Package::Rpm do
|
|
71
71
|
let(:package_source) { "foobar://example.com/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" }
|
72
72
|
|
73
73
|
it "should raise an exception if an uri formed source is non-supported scheme" do
|
74
|
-
allow(::File).to receive(:
|
74
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(false)
|
75
75
|
|
76
76
|
# verify let bindings are as we expect
|
77
77
|
expect(new_resource.source).to eq("foobar://example.com/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
@@ -86,18 +86,18 @@ describe Chef::Provider::Package::Rpm do
|
|
86
86
|
|
87
87
|
before do
|
88
88
|
expect(provider).to receive(:shell_out!).
|
89
|
-
with("rpm -qp --queryformat
|
89
|
+
with("rpm", "-qp", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", package_source, timeout: 900).
|
90
90
|
and_return(rpm_qp_status)
|
91
91
|
|
92
92
|
expect(provider).to receive(:shell_out).
|
93
|
-
with("rpm -q --queryformat
|
93
|
+
with("rpm", "-q", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", package_name, timeout: 900).
|
94
94
|
and_return(rpm_q_status)
|
95
95
|
end
|
96
96
|
|
97
97
|
context "when rpm fails when querying package installed state" do
|
98
98
|
|
99
99
|
before do
|
100
|
-
allow(::File).to receive(:
|
100
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(true)
|
101
101
|
end
|
102
102
|
|
103
103
|
let(:rpm_qp_stdout) { "ImageMagick-c++ 6.5.4.7-7.el6_5" }
|
@@ -129,7 +129,7 @@ describe Chef::Provider::Package::Rpm do
|
|
129
129
|
context "when the source is a file system path" do
|
130
130
|
|
131
131
|
before do
|
132
|
-
allow(::File).to receive(:
|
132
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(true)
|
133
133
|
|
134
134
|
provider.action = action
|
135
135
|
|
@@ -151,7 +151,7 @@ describe Chef::Provider::Package::Rpm do
|
|
151
151
|
|
152
152
|
context "when at the desired version already" do
|
153
153
|
it "does nothing when the correct version is installed" do
|
154
|
-
expect(provider).to_not receive(:shell_out!).with("rpm
|
154
|
+
expect(provider).to_not receive(:shell_out!).with("rpm", "-i", "/tmp/imagemagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
155
155
|
|
156
156
|
provider.action_install
|
157
157
|
end
|
@@ -162,7 +162,7 @@ describe Chef::Provider::Package::Rpm do
|
|
162
162
|
let(:rpm_q_stdout) { "imagemagick-c++ 0.5.4.7-7.el6_5" }
|
163
163
|
|
164
164
|
it "runs rpm -u with the package source to upgrade" do
|
165
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
165
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-U", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
166
166
|
provider.action_install
|
167
167
|
end
|
168
168
|
end
|
@@ -178,7 +178,7 @@ describe Chef::Provider::Package::Rpm do
|
|
178
178
|
let(:rpm_q_stdout) { "imagemagick-c++ 21.4-19.el6_5" }
|
179
179
|
|
180
180
|
it "should run rpm -u --oldpackage with the package source to downgrade" do
|
181
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
181
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-U", "--oldpackage", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
182
182
|
provider.action_install
|
183
183
|
end
|
184
184
|
|
@@ -192,7 +192,7 @@ describe Chef::Provider::Package::Rpm do
|
|
192
192
|
|
193
193
|
context "when at the desired version already" do
|
194
194
|
it "does nothing when the correct version is installed" do
|
195
|
-
expect(provider).to_not receive(:shell_out!).with("rpm
|
195
|
+
expect(provider).to_not receive(:shell_out!).with("rpm", "-i", "/tmp/imagemagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
196
196
|
|
197
197
|
provider.action_upgrade
|
198
198
|
end
|
@@ -203,7 +203,7 @@ describe Chef::Provider::Package::Rpm do
|
|
203
203
|
let(:rpm_q_stdout) { "imagemagick-c++ 0.5.4.7-7.el6_5" }
|
204
204
|
|
205
205
|
it "runs rpm -u with the package source to upgrade" do
|
206
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
206
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-U", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
207
207
|
provider.action_upgrade
|
208
208
|
end
|
209
209
|
end
|
@@ -219,7 +219,7 @@ describe Chef::Provider::Package::Rpm do
|
|
219
219
|
let(:rpm_q_stdout) { "imagemagick-c++ 21.4-19.el6_5" }
|
220
220
|
|
221
221
|
it "should run rpm -u --oldpackage with the package source to downgrade" do
|
222
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
222
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-U", "--oldpackage", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
223
223
|
provider.action_upgrade
|
224
224
|
end
|
225
225
|
|
@@ -231,7 +231,7 @@ describe Chef::Provider::Package::Rpm do
|
|
231
231
|
let(:action) { :remove }
|
232
232
|
|
233
233
|
it "should remove the package" do
|
234
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
234
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-e", "ImageMagick-c++-6.5.4.7-7.el6_5", timeout: 900)
|
235
235
|
provider.action_remove
|
236
236
|
end
|
237
237
|
end
|
@@ -276,7 +276,7 @@ describe Chef::Provider::Package::Rpm do
|
|
276
276
|
|
277
277
|
context "when the source is given as an URI" do
|
278
278
|
before(:each) do
|
279
|
-
allow(::File).to receive(:
|
279
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(false)
|
280
280
|
|
281
281
|
provider.action = action
|
282
282
|
|
@@ -322,7 +322,7 @@ describe Chef::Provider::Package::Rpm do
|
|
322
322
|
let(:action) { :install }
|
323
323
|
|
324
324
|
before do
|
325
|
-
allow(File).to receive(:
|
325
|
+
allow(File).to receive(:exist?).with(package_source).and_return(true)
|
326
326
|
|
327
327
|
provider.action = action
|
328
328
|
|
@@ -357,7 +357,7 @@ describe Chef::Provider::Package::Rpm do
|
|
357
357
|
describe "action install" do
|
358
358
|
|
359
359
|
it "installs the package" do
|
360
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
360
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-i", package_source, timeout: 900)
|
361
361
|
|
362
362
|
provider.action_install
|
363
363
|
end
|
@@ -365,7 +365,7 @@ describe Chef::Provider::Package::Rpm do
|
|
365
365
|
context "when custom resource options are given" do
|
366
366
|
it "installs with custom options specified in the resource" do
|
367
367
|
new_resource.options("--dbpath /var/lib/rpm")
|
368
|
-
expect(provider).to receive(:shell_out!).with("rpm --dbpath /var/lib/rpm -i
|
368
|
+
expect(provider).to receive(:shell_out!).with("rpm", "--dbpath", "/var/lib/rpm", "-i", package_source, timeout: 900)
|
369
369
|
provider.action_install
|
370
370
|
end
|
371
371
|
end
|
@@ -376,7 +376,7 @@ describe Chef::Provider::Package::Rpm do
|
|
376
376
|
let(:action) { :upgrade }
|
377
377
|
|
378
378
|
it "installs the package" do
|
379
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
379
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-i", package_source, timeout: 900)
|
380
380
|
|
381
381
|
provider.action_upgrade
|
382
382
|
end
|
@@ -387,7 +387,7 @@ describe Chef::Provider::Package::Rpm do
|
|
387
387
|
let(:action) { :remove }
|
388
388
|
|
389
389
|
it "should do nothing" do
|
390
|
-
expect(provider).to_not receive(:shell_out!).with("rpm
|
390
|
+
expect(provider).to_not receive(:shell_out!).with("rpm", "-e", "ImageMagick-c++-6.5.4.7-7.el6_5", timeout: 900)
|
391
391
|
provider.action_remove
|
392
392
|
end
|
393
393
|
end
|
@@ -404,7 +404,7 @@ describe Chef::Provider::Package::Rpm do
|
|
404
404
|
# provider will call File.exists?. Because of the ordering in our
|
405
405
|
# let() bindings and such, we have to set the stub here and not in a
|
406
406
|
# before block.
|
407
|
-
allow(::File).to receive(:
|
407
|
+
allow(::File).to receive(:exist?).with(package_source).and_return(true)
|
408
408
|
Chef::Resource::Package.new("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
409
409
|
end
|
410
410
|
|
@@ -413,7 +413,7 @@ describe Chef::Provider::Package::Rpm do
|
|
413
413
|
it "should install from a path when the package is a path and the source is nil" do
|
414
414
|
expect(new_resource.source).to eq("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
415
415
|
provider.current_resource = current_resource
|
416
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
416
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-i", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
417
417
|
provider.install_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
|
418
418
|
end
|
419
419
|
|
@@ -421,7 +421,7 @@ describe Chef::Provider::Package::Rpm do
|
|
421
421
|
expect(new_resource.source).to eq("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
422
422
|
current_resource.version("21.4-19.el5")
|
423
423
|
provider.current_resource = current_resource
|
424
|
-
expect(provider).to receive(:shell_out!).with("rpm
|
424
|
+
expect(provider).to receive(:shell_out!).with("rpm", "-U", "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
425
425
|
provider.upgrade_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
|
426
426
|
end
|
427
427
|
end
|
@@ -144,30 +144,30 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
144
144
|
|
145
145
|
it "installs a gem with a hash of options for the dependency installer" do
|
146
146
|
dep_installer = Gem::DependencyInstaller.new
|
147
|
-
expect(@gem_env).to receive(:dependency_installer).with(:
|
147
|
+
expect(@gem_env).to receive(:dependency_installer).with(install_dir: "/foo/bar").and_return(dep_installer)
|
148
148
|
expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield
|
149
149
|
expect(dep_installer).to receive(:install).with(Gem::Dependency.new("rspec", ">= 0"))
|
150
|
-
@gem_env.install(Gem::Dependency.new("rspec", ">= 0"), :
|
150
|
+
@gem_env.install(Gem::Dependency.new("rspec", ">= 0"), install_dir: "/foo/bar", sources: ["http://gems.example.com"])
|
151
151
|
end
|
152
152
|
|
153
153
|
it "builds an uninstaller for a gem with options set to avoid requiring user input" do
|
154
154
|
# default options for uninstaller should be:
|
155
155
|
# :ignore => true, :executables => true
|
156
|
-
expect(Gem::Uninstaller).to receive(:new).with("rspec", :
|
156
|
+
expect(Gem::Uninstaller).to receive(:new).with("rspec", ignore: true, executables: true)
|
157
157
|
@gem_env.uninstaller("rspec")
|
158
158
|
end
|
159
159
|
|
160
160
|
it "uninstalls all versions of a gem" do
|
161
161
|
uninstaller = double("gem uninstaller")
|
162
162
|
expect(uninstaller).to receive(:uninstall)
|
163
|
-
expect(@gem_env).to receive(:uninstaller).with("rspec", :
|
163
|
+
expect(@gem_env).to receive(:uninstaller).with("rspec", all: true).and_return(uninstaller)
|
164
164
|
@gem_env.uninstall("rspec")
|
165
165
|
end
|
166
166
|
|
167
167
|
it "uninstalls a specific version of a gem" do
|
168
168
|
uninstaller = double("gem uninstaller")
|
169
169
|
expect(uninstaller).to receive(:uninstall)
|
170
|
-
expect(@gem_env).to receive(:uninstaller).with("rspec", :
|
170
|
+
expect(@gem_env).to receive(:uninstaller).with("rspec", version: "1.2.3").and_return(uninstaller)
|
171
171
|
@gem_env.uninstall("rspec", "1.2.3")
|
172
172
|
end
|
173
173
|
|
@@ -184,14 +184,14 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
|
|
184
184
|
|
185
185
|
it "determines the gem paths from shelling out to gem env" do
|
186
186
|
gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR)
|
187
|
-
shell_out_result = OpenStruct.new(:
|
187
|
+
shell_out_result = OpenStruct.new(stdout: gem_env_output)
|
188
188
|
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result)
|
189
189
|
expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
|
190
190
|
end
|
191
191
|
|
192
192
|
it "caches the gempaths by gem_binary" do
|
193
193
|
gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR)
|
194
|
-
shell_out_result = OpenStruct.new(:
|
194
|
+
shell_out_result = OpenStruct.new(stdout: gem_env_output)
|
195
195
|
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result)
|
196
196
|
expected = ["/path/to/gems", "/another/path/to/gems"]
|
197
197
|
expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
|
@@ -271,7 +271,7 @@ RubyGems Environment:
|
|
271
271
|
- https://rubygems.org/
|
272
272
|
- http://gems.github.com/
|
273
273
|
JRUBY_GEM_ENV
|
274
|
-
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", :
|
274
|
+
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", stdout: gem_env_out))
|
275
275
|
expected = ["ruby", Gem::Platform.new("universal-java-1.6")]
|
276
276
|
expect(@gem_env.gem_platforms).to eq(expected)
|
277
277
|
# it should also cache the result
|
@@ -313,7 +313,7 @@ RubyGems Environment:
|
|
313
313
|
- https://rubygems.org/
|
314
314
|
- http://gems.github.com/
|
315
315
|
RBX_GEM_ENV
|
316
|
-
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", :
|
316
|
+
expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", stdout: gem_env_out))
|
317
317
|
expect(@gem_env.gem_platforms).to eq(Gem.platforms)
|
318
318
|
expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]).to eq(Gem.platforms)
|
319
319
|
end
|
@@ -351,7 +351,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
351
351
|
new_resource
|
352
352
|
end
|
353
353
|
|
354
|
-
let
|
354
|
+
let(:current_resource) { nil }
|
355
355
|
|
356
356
|
let(:provider) do
|
357
357
|
run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
|
@@ -403,7 +403,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
403
403
|
end
|
404
404
|
|
405
405
|
context "when you try to use a hash of install options" do
|
406
|
-
let(:options) { { :
|
406
|
+
let(:options) { { fail: :burger } }
|
407
407
|
|
408
408
|
it "smites you" do
|
409
409
|
expect { provider }.to raise_error(ArgumentError)
|
@@ -437,9 +437,9 @@ describe Chef::Provider::Package::Rubygems do
|
|
437
437
|
it "searches for a gem binary when running on Omnibus on Unix" do
|
438
438
|
platform_mock :unix do
|
439
439
|
allow(ENV).to receive(:[]).with("PATH").and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
|
440
|
-
allow(File).to receive(:
|
441
|
-
allow(File).to receive(:
|
442
|
-
allow(File).to receive(:
|
440
|
+
allow(File).to receive(:exist?).with("/usr/bin/gem").and_return(false)
|
441
|
+
allow(File).to receive(:exist?).with("/usr/sbin/gem").and_return(true)
|
442
|
+
allow(File).to receive(:exist?).with("/opt/chef/embedded/bin/gem").and_return(true) # should not get here
|
443
443
|
expect(provider.gem_env.gem_binary_location).to eq("/usr/sbin/gem")
|
444
444
|
end
|
445
445
|
end
|
@@ -450,11 +450,11 @@ describe Chef::Provider::Package::Rubygems do
|
|
450
450
|
it "searches for a gem binary when running on Omnibus on Windows" do
|
451
451
|
platform_mock :windows do
|
452
452
|
allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
|
453
|
-
allow(File).to receive(:
|
454
|
-
allow(File).to receive(:
|
455
|
-
allow(File).to receive(:
|
456
|
-
allow(File).to receive(:
|
457
|
-
allow(File).to receive(:
|
453
|
+
allow(File).to receive(:exist?).with('C:\\windows\\system32\\gem').and_return(false)
|
454
|
+
allow(File).to receive(:exist?).with('C:\\windows\\gem').and_return(false)
|
455
|
+
allow(File).to receive(:exist?).with('C:\\Ruby186\\bin\\gem').and_return(true)
|
456
|
+
allow(File).to receive(:exist?).with('d:\\opscode\\chef\\bin\\gem').and_return(false) # should not get here
|
457
|
+
allow(File).to receive(:exist?).with('d:\\opscode\\chef\\embedded\\bin\\gem').and_return(false) # should not get here
|
458
458
|
expect(provider.gem_env.gem_binary_location).to eq('C:\Ruby186\bin\gem')
|
459
459
|
end
|
460
460
|
end
|
@@ -526,8 +526,8 @@ describe Chef::Provider::Package::Rubygems do
|
|
526
526
|
end
|
527
527
|
|
528
528
|
it "queries for available versions on upgrade" do
|
529
|
-
expect(provider.gem_env).to receive(:candidate_version_from_remote)
|
530
|
-
and_return(Gem::Version.new("9000.0.2"))
|
529
|
+
expect(provider.gem_env).to receive(:candidate_version_from_remote)
|
530
|
+
.and_return(Gem::Version.new("9000.0.2"))
|
531
531
|
expect(provider.gem_env).to receive(:install)
|
532
532
|
provider.run_action(:upgrade)
|
533
533
|
expect(new_resource).to be_updated_by_last_action
|
@@ -538,17 +538,17 @@ describe Chef::Provider::Package::Rubygems do
|
|
538
538
|
let(:source) { "http://mygems.example.com" }
|
539
539
|
|
540
540
|
it "determines the candidate version by querying the remote gem servers" do
|
541
|
-
expect(provider.gem_env).to receive(:candidate_version_from_remote)
|
542
|
-
with(gem_dep, source)
|
543
|
-
and_return(Gem::Version.new(target_version))
|
541
|
+
expect(provider.gem_env).to receive(:candidate_version_from_remote)
|
542
|
+
.with(gem_dep, source)
|
543
|
+
.and_return(Gem::Version.new(target_version))
|
544
544
|
expect(provider.candidate_version).to eq(target_version)
|
545
545
|
end
|
546
546
|
end
|
547
547
|
|
548
548
|
context "when the requested source is a file" do
|
549
|
-
let
|
550
|
-
let
|
551
|
-
let
|
549
|
+
let(:gem_name) { "chef-integration-test" }
|
550
|
+
let(:source) { CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem" }
|
551
|
+
let(:target_version) { ">= 0" }
|
552
552
|
|
553
553
|
it "parses the gem's specification" do
|
554
554
|
expect(provider.candidate_version).to eq("0.1.0")
|
@@ -570,14 +570,14 @@ describe Chef::Provider::Package::Rubygems do
|
|
570
570
|
version = Gem::Version.new(candidate_version)
|
571
571
|
args = [gem_dep]
|
572
572
|
args << source if source
|
573
|
-
allow(provider.gem_env).to receive(:candidate_version_from_remote)
|
574
|
-
with(*args)
|
575
|
-
and_return(version)
|
573
|
+
allow(provider.gem_env).to receive(:candidate_version_from_remote)
|
574
|
+
.with(*args)
|
575
|
+
.and_return(version)
|
576
576
|
end
|
577
577
|
|
578
578
|
describe "in the current gem environment" do
|
579
579
|
it "installs the gem via the gems api when no explicit options are used" do
|
580
|
-
expect(provider.gem_env).to receive(:install).with(gem_dep, :
|
580
|
+
expect(provider.gem_env).to receive(:install).with(gem_dep, sources: nil)
|
581
581
|
provider.run_action(:install)
|
582
582
|
expect(new_resource).to be_updated_by_last_action
|
583
583
|
end
|
@@ -586,7 +586,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
586
586
|
let(:source) { "http://gems.example.org" }
|
587
587
|
|
588
588
|
it "installs the gem via the gems api" do
|
589
|
-
expect(provider.gem_env).to receive(:install).with(gem_dep, :
|
589
|
+
expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [source])
|
590
590
|
provider.run_action(:install)
|
591
591
|
expect(new_resource).to be_updated_by_last_action
|
592
592
|
end
|
@@ -615,9 +615,9 @@ describe Chef::Provider::Package::Rubygems do
|
|
615
615
|
|
616
616
|
# this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem
|
617
617
|
it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do
|
618
|
-
allow(::File).to receive(:
|
618
|
+
allow(::File).to receive(:exist?).and_return(true)
|
619
619
|
new_resource.package_name("rspec-core")
|
620
|
-
expect(provider.gem_env).to receive(:install).with(gem_dep, :
|
620
|
+
expect(provider.gem_env).to receive(:install).with(gem_dep, sources: nil)
|
621
621
|
provider.run_action(:install)
|
622
622
|
expect(new_resource).to be_updated_by_last_action
|
623
623
|
end
|
@@ -671,10 +671,10 @@ describe Chef::Provider::Package::Rubygems do
|
|
671
671
|
end
|
672
672
|
|
673
673
|
context "when options are given as a Hash" do
|
674
|
-
let(:options) { { :
|
674
|
+
let(:options) { { install_dir: "/alt/install/location" } }
|
675
675
|
|
676
676
|
it "installs the gem via the gems api when options are given as a Hash" do
|
677
|
-
expect(provider.gem_env).to receive(:install).with(gem_dep, { :
|
677
|
+
expect(provider.gem_env).to receive(:install).with(gem_dep, { sources: nil }.merge(options))
|
678
678
|
provider.run_action(:install)
|
679
679
|
expect(new_resource).to be_updated_by_last_action
|
680
680
|
end
|
@@ -684,7 +684,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
684
684
|
let(:target_version) { "9000.0.2" }
|
685
685
|
|
686
686
|
it "installs the gem via the gems api" do
|
687
|
-
expect(provider.gem_env).to receive(:install).with(gem_dep, :
|
687
|
+
expect(provider.gem_env).to receive(:install).with(gem_dep, sources: nil)
|
688
688
|
provider.run_action(:install)
|
689
689
|
expect(new_resource).to be_updated_by_last_action
|
690
690
|
end
|
@@ -780,7 +780,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
780
780
|
end
|
781
781
|
|
782
782
|
context "when options are given as a Hash" do
|
783
|
-
let(:options) { { :
|
783
|
+
let(:options) { { install_dir: "/alt/install/location" } }
|
784
784
|
|
785
785
|
it "uninstalls via the api" do
|
786
786
|
# pre-reqs for action_remove to actually remove the package:
|