chef 12.4.0.rc.0-universal-mingw32 → 12.4.0.rc.2-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +12 -1
- data/lib/chef/api_client.rb +130 -26
- data/lib/chef/application.rb +0 -1
- data/lib/chef/application/client.rb +8 -19
- data/lib/chef/audit/audit_reporter.rb +12 -7
- data/lib/chef/audit/logger.rb +36 -0
- data/lib/chef/audit/runner.rb +4 -2
- data/lib/chef/chef_class.rb +62 -11
- data/lib/chef/client.rb +587 -207
- data/lib/chef/config.rb +0 -1
- data/lib/chef/dsl/recipe.rb +45 -56
- data/lib/chef/dsl/resources.rb +3 -2
- data/lib/chef/event_dispatch/base.rb +7 -2
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_content_management/deploy/mv_windows.rb +16 -6
- data/lib/chef/formatters/doc.rb +15 -7
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +10 -7
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -0
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +4 -1
- data/lib/chef/http/authenticator.rb +7 -2
- data/lib/chef/knife.rb +16 -4
- data/lib/chef/knife/client_create.rb +55 -31
- data/lib/chef/knife/core/generic_presenter.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/osc_user_create.rb +97 -0
- data/lib/chef/knife/osc_user_delete.rb +51 -0
- data/lib/chef/knife/osc_user_edit.rb +58 -0
- data/lib/chef/knife/osc_user_list.rb +47 -0
- data/lib/chef/knife/osc_user_reregister.rb +64 -0
- data/lib/chef/knife/osc_user_show.rb +54 -0
- data/lib/chef/knife/user_create.rb +95 -36
- data/lib/chef/knife/user_delete.rb +52 -2
- data/lib/chef/knife/user_edit.rb +37 -7
- data/lib/chef/knife/user_list.rb +3 -0
- data/lib/chef/knife/user_reregister.rb +39 -8
- data/lib/chef/knife/user_show.rb +30 -1
- data/lib/chef/mixin/api_version_request_handling.rb +66 -0
- data/lib/chef/mixin/convert_to_class_name.rb +10 -4
- data/lib/chef/mixin/deprecation.rb +24 -0
- data/lib/chef/mixin/powershell_out.rb +98 -0
- data/lib/chef/mixin/provides.rb +5 -18
- data/lib/chef/mixin/uris.rb +11 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +5 -2
- data/lib/chef/mixin/windows_env_helper.rb +11 -2
- data/lib/chef/node_map.rb +130 -75
- data/lib/chef/osc_user.rb +194 -0
- data/lib/chef/platform/provider_mapping.rb +2 -269
- data/lib/chef/platform/provider_priority_map.rb +6 -69
- data/lib/chef/platform/query_helpers.rb +5 -0
- data/lib/chef/platform/resource_priority_map.rb +12 -15
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/provider.rb +19 -0
- data/lib/chef/provider/directory.rb +3 -0
- data/lib/chef/provider/dsc_resource.rb +8 -1
- data/lib/chef/provider/file.rb +1 -0
- data/lib/chef/provider/group/aix.rb +1 -0
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/group/gpasswd.rb +1 -0
- data/lib/chef/provider/group/groupmod.rb +1 -1
- data/lib/chef/provider/group/pw.rb +1 -0
- data/lib/chef/provider/group/suse.rb +2 -0
- data/lib/chef/provider/group/usermod.rb +2 -1
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +2 -0
- data/lib/chef/provider/ifconfig/aix.rb +1 -0
- data/lib/chef/provider/ifconfig/debian.rb +2 -0
- data/lib/chef/provider/ifconfig/redhat.rb +1 -0
- data/lib/chef/provider/lwrp_base.rb +4 -0
- data/lib/chef/provider/mount.rb +0 -1
- data/lib/chef/provider/mount/aix.rb +1 -0
- data/lib/chef/provider/mount/mount.rb +2 -0
- data/lib/chef/provider/mount/solaris.rb +2 -0
- data/lib/chef/provider/package.rb +55 -0
- data/lib/chef/provider/package/aix.rb +7 -7
- data/lib/chef/provider/package/apt.rb +3 -3
- data/lib/chef/provider/package/dpkg.rb +4 -4
- data/lib/chef/provider/package/easy_install.rb +5 -5
- data/lib/chef/provider/package/freebsd/base.rb +2 -2
- data/lib/chef/provider/package/freebsd/pkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/pkgng.rb +5 -5
- data/lib/chef/provider/package/freebsd/port.rb +4 -4
- data/lib/chef/provider/package/homebrew.rb +2 -2
- data/lib/chef/provider/package/ips.rb +4 -4
- data/lib/chef/provider/package/macports.rb +5 -6
- data/lib/chef/provider/package/openbsd.rb +4 -5
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/portage.rb +2 -0
- data/lib/chef/provider/package/rpm.rb +7 -8
- data/lib/chef/provider/package/rubygems.rb +5 -12
- data/lib/chef/provider/package/smartos.rb +4 -4
- data/lib/chef/provider/package/solaris.rb +7 -7
- data/lib/chef/provider/package/windows/msi.rb +1 -1
- data/lib/chef/provider/package/yum.rb +4 -6
- data/lib/chef/provider/package/zypper.rb +16 -14
- data/lib/chef/provider/powershell_script.rb +129 -47
- data/lib/chef/provider/remote_file/content.rb +4 -1
- data/lib/chef/provider/remote_file/local_file.rb +10 -4
- data/lib/chef/provider/service.rb +44 -0
- data/lib/chef/provider/service/freebsd.rb +1 -1
- data/lib/chef/provider/service/init.rb +1 -0
- data/lib/chef/provider/service/macosx.rb +1 -1
- data/lib/chef/provider/service/windows.rb +0 -1
- data/lib/chef/provider/user.rb +1 -1
- data/lib/chef/provider/user/aix.rb +3 -2
- data/lib/chef/provider/user/pw.rb +1 -0
- data/lib/chef/provider/user/solaris.rb +2 -0
- data/lib/chef/provider/user/useradd.rb +1 -0
- data/lib/chef/provider_resolver.rb +87 -134
- data/lib/chef/resource.rb +274 -68
- data/lib/chef/resource/apt_package.rb +0 -2
- data/lib/chef/resource/bash.rb +0 -2
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +0 -7
- data/lib/chef/resource/breakpoint.rb +3 -6
- data/lib/chef/resource/chef_gem.rb +0 -3
- data/lib/chef/resource/cookbook_file.rb +1 -3
- data/lib/chef/resource/cron.rb +2 -4
- data/lib/chef/resource/csh.rb +0 -2
- data/lib/chef/resource/deploy.rb +9 -6
- data/lib/chef/resource/deploy_revision.rb +0 -14
- data/lib/chef/resource/directory.rb +2 -4
- data/lib/chef/resource/dpkg_package.rb +0 -5
- data/lib/chef/resource/dsc_resource.rb +2 -3
- data/lib/chef/resource/dsc_script.rb +2 -3
- data/lib/chef/resource/easy_install_package.rb +0 -7
- data/lib/chef/resource/env.rb +3 -3
- data/lib/chef/resource/erl_call.rb +2 -5
- data/lib/chef/resource/execute.rb +2 -4
- data/lib/chef/resource/file.rb +2 -4
- data/lib/chef/resource/freebsd_package.rb +0 -5
- data/lib/chef/resource/gem_package.rb +0 -3
- data/lib/chef/resource/git.rb +0 -3
- data/lib/chef/resource/group.rb +2 -4
- data/lib/chef/resource/homebrew_package.rb +0 -2
- data/lib/chef/resource/http_request.rb +3 -4
- data/lib/chef/resource/ifconfig.rb +3 -4
- data/lib/chef/resource/ips_package.rb +2 -2
- data/lib/chef/resource/link.rb +3 -5
- data/lib/chef/resource/log.rb +2 -4
- data/lib/chef/resource/lwrp_base.rb +10 -61
- data/lib/chef/resource/macosx_service.rb +1 -2
- data/lib/chef/resource/macports_package.rb +0 -7
- data/lib/chef/resource/mdadm.rb +2 -5
- data/lib/chef/resource/mount.rb +2 -4
- data/lib/chef/resource/ohai.rb +2 -4
- data/lib/chef/resource/openbsd_package.rb +0 -6
- data/lib/chef/resource/package.rb +9 -6
- data/lib/chef/resource/pacman_package.rb +0 -7
- data/lib/chef/resource/paludis_package.rb +2 -3
- data/lib/chef/resource/perl.rb +0 -3
- data/lib/chef/resource/portage_package.rb +0 -3
- data/lib/chef/resource/powershell_script.rb +1 -2
- data/lib/chef/resource/python.rb +0 -3
- data/lib/chef/resource/reboot.rb +1 -3
- data/lib/chef/resource/registry_key.rb +3 -5
- data/lib/chef/resource/remote_directory.rb +3 -5
- data/lib/chef/resource/remote_file.rb +4 -5
- data/lib/chef/resource/route.rb +3 -5
- data/lib/chef/resource/rpm_package.rb +0 -2
- data/lib/chef/resource/ruby.rb +0 -4
- data/lib/chef/resource/ruby_block.rb +2 -4
- data/lib/chef/resource/scm.rb +3 -5
- data/lib/chef/resource/script.rb +0 -3
- data/lib/chef/resource/service.rb +3 -5
- data/lib/chef/resource/smartos_package.rb +0 -9
- data/lib/chef/resource/solaris_package.rb +0 -10
- data/lib/chef/resource/subversion.rb +1 -3
- data/lib/chef/resource/template.rb +0 -4
- data/lib/chef/resource/timestamped_deploy.rb +0 -4
- data/lib/chef/resource/user.rb +2 -5
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -7
- data/lib/chef/resource/windows_package.rb +3 -3
- data/lib/chef/resource/windows_script.rb +2 -2
- data/lib/chef/resource/windows_service.rb +3 -3
- data/lib/chef/resource/yum_package.rb +0 -3
- data/lib/chef/resource/zypper_package.rb +27 -0
- data/lib/chef/resource_builder.rb +7 -0
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/resource_resolver.rb +108 -62
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/rest.rb +1 -0
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/user.rb +193 -42
- data/lib/chef/util/backup.rb +9 -1
- data/lib/chef/util/path_helper.rb +0 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/audit/runner_spec.rb +22 -42
- data/spec/functional/mixin/powershell_out_spec.rb +43 -0
- data/spec/functional/resource/execute_spec.rb +9 -2
- data/spec/functional/resource/file_spec.rb +25 -0
- data/spec/functional/resource/group_spec.rb +5 -0
- data/spec/functional/resource/link_spec.rb +5 -11
- data/spec/functional/resource/powershell_spec.rb +40 -5
- data/spec/functional/resource/user/useradd_spec.rb +10 -18
- data/spec/integration/recipes/lwrp_spec.rb +57 -0
- data/spec/integration/recipes/provider_choice.rb +2 -7
- data/spec/integration/recipes/recipe_dsl_spec.rb +517 -19
- data/spec/spec_helper.rb +1 -1
- data/spec/support/lib/chef/provider/openldap_includer.rb +29 -0
- data/spec/support/lib/chef/resource/cat.rb +0 -2
- data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -6
- data/spec/support/lib/chef/resource/openldap_includer.rb +27 -0
- data/spec/support/lib/chef/resource/with_state.rb +0 -9
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -6
- data/spec/support/lib/chef/resource/zen_master.rb +1 -6
- data/spec/support/shared/context/client.rb +277 -0
- data/spec/support/shared/examples/client.rb +53 -0
- data/spec/support/shared/functional/file_resource.rb +0 -4
- data/spec/support/shared/functional/securable_resource.rb +0 -24
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +4 -4
- data/spec/support/shared/functional/windows_script.rb +1 -1
- data/spec/support/shared/unit/api_versioning.rb +77 -0
- data/spec/support/shared/unit/knife_shared.rb +40 -0
- data/spec/support/shared/unit/user_and_client_shared.rb +115 -0
- data/spec/unit/api_client_spec.rb +189 -14
- data/spec/unit/application/client_spec.rb +0 -5
- data/spec/unit/audit/audit_reporter_spec.rb +58 -14
- data/spec/unit/audit/logger_spec.rb +42 -0
- data/spec/unit/audit/runner_spec.rb +2 -2
- data/spec/unit/chef_fs/file_pattern_spec.rb +3 -15
- data/spec/unit/client_spec.rb +58 -374
- data/spec/unit/cookbook_spec.rb +0 -9
- data/spec/unit/cookbook_version_spec.rb +0 -20
- data/spec/unit/deprecation_spec.rb +55 -0
- data/spec/unit/dsl/resources_spec.rb +85 -0
- data/spec/unit/exceptions_spec.rb +2 -2
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +60 -0
- data/spec/unit/formatters/doc_spec.rb +46 -0
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +12 -10
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +8 -0
- data/spec/unit/http/authenticator_spec.rb +11 -2
- data/spec/unit/knife/client_create_spec.rb +122 -51
- data/spec/unit/knife/core/subcommand_loader_spec.rb +19 -3
- data/spec/unit/knife/core/ui_spec.rb +14 -0
- data/spec/unit/knife/osc_user_create_spec.rb +93 -0
- data/spec/unit/knife/osc_user_delete_spec.rb +44 -0
- data/spec/unit/knife/osc_user_edit_spec.rb +52 -0
- data/spec/unit/knife/osc_user_list_spec.rb +37 -0
- data/spec/unit/knife/osc_user_reregister_spec.rb +58 -0
- data/spec/unit/knife/osc_user_show_spec.rb +46 -0
- data/spec/unit/knife/user_create_spec.rb +177 -51
- data/spec/unit/knife/user_delete_spec.rb +34 -8
- data/spec/unit/knife/user_edit_spec.rb +31 -12
- data/spec/unit/knife/user_list_spec.rb +7 -3
- data/spec/unit/knife/user_reregister_spec.rb +38 -17
- data/spec/unit/knife/user_show_spec.rb +35 -11
- data/spec/unit/knife_spec.rb +10 -4
- data/spec/unit/lwrp_spec.rb +228 -54
- data/spec/unit/mixin/api_version_request_handling_spec.rb +127 -0
- data/spec/unit/mixin/command_spec.rb +1 -2
- data/spec/unit/mixin/powershell_out_spec.rb +70 -0
- data/spec/unit/mixin/uris_spec.rb +23 -11
- data/spec/unit/node_map_spec.rb +4 -1
- data/spec/unit/osc_user_spec.rb +276 -0
- data/spec/unit/platform_spec.rb +0 -60
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +199 -135
- data/spec/unit/provider/ifconfig/debian_spec.rb +0 -10
- data/spec/unit/provider/package/aix_spec.rb +16 -16
- data/spec/unit/provider/package/dpkg_spec.rb +2 -2
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +13 -13
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +7 -7
- data/spec/unit/provider/package/ips_spec.rb +22 -22
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +4 -26
- data/spec/unit/provider/package/pacman_spec.rb +5 -5
- data/spec/unit/provider/package/rpm_spec.rb +14 -14
- data/spec/unit/provider/package/rubygems_spec.rb +10 -44
- data/spec/unit/provider/package/smartos_spec.rb +4 -4
- data/spec/unit/provider/package/solaris_spec.rb +11 -11
- data/spec/unit/provider/package/zypper_spec.rb +125 -90
- data/spec/unit/provider/package_spec.rb +34 -0
- data/spec/unit/provider/powershell_spec.rb +53 -11
- data/spec/unit/provider/remote_directory_spec.rb +2 -2
- data/spec/unit/provider/remote_file/local_file_spec.rb +25 -6
- data/spec/unit/provider/service/freebsd_service_spec.rb +0 -12
- data/spec/unit/provider/user_spec.rb +3 -3
- data/spec/unit/provider_resolver_spec.rb +463 -327
- data/spec/unit/recipe_spec.rb +42 -15
- data/spec/unit/resource/breakpoint_spec.rb +1 -1
- data/spec/unit/resource/erl_call_spec.rb +1 -1
- data/spec/unit/resource/file_spec.rb +1 -1
- data/spec/unit/resource/ifconfig_spec.rb +10 -6
- data/spec/unit/resource/remote_file_spec.rb +5 -0
- data/spec/unit/resource/route_spec.rb +1 -1
- data/spec/unit/resource/ruby_block_spec.rb +2 -2
- data/spec/unit/resource/template_spec.rb +1 -1
- data/spec/unit/resource/timestamped_deploy_spec.rb +1 -2
- data/spec/unit/resource/windows_service_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +99 -13
- data/spec/unit/rest_spec.rb +5 -5
- data/spec/unit/run_context_spec.rb +41 -0
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/user_spec.rb +406 -93
- data/tasks/maintainers.rb +69 -0
- metadata +37 -4
@@ -105,7 +105,7 @@ EOF
|
|
105
105
|
it "should run the port install command with the correct version" do
|
106
106
|
expect(@current_resource).to receive(:version).and_return("4.1.6")
|
107
107
|
@provider.current_resource = @current_resource
|
108
|
-
expect(@provider).to receive(:shell_out!).with("port install zsh @4.2.7")
|
108
|
+
expect(@provider).to receive(:shell_out!).with("port install zsh @4.2.7", timeout: 900)
|
109
109
|
|
110
110
|
@provider.install_package("zsh", "4.2.7")
|
111
111
|
end
|
@@ -122,7 +122,7 @@ EOF
|
|
122
122
|
expect(@current_resource).to receive(:version).and_return("4.1.6")
|
123
123
|
@provider.current_resource = @current_resource
|
124
124
|
allow(@new_resource).to receive(:options).and_return("-f")
|
125
|
-
expect(@provider).to receive(:shell_out!).with("port -f install zsh @4.2.7")
|
125
|
+
expect(@provider).to receive(:shell_out!).with("port -f install zsh @4.2.7", timeout: 900)
|
126
126
|
|
127
127
|
@provider.install_package("zsh", "4.2.7")
|
128
128
|
end
|
@@ -130,36 +130,36 @@ EOF
|
|
130
130
|
|
131
131
|
describe "purge_package" do
|
132
132
|
it "should run the port uninstall command with the correct version" do
|
133
|
-
expect(@provider).to receive(:shell_out!).with("port uninstall zsh @4.2.7")
|
133
|
+
expect(@provider).to receive(:shell_out!).with("port uninstall zsh @4.2.7", timeout: 900)
|
134
134
|
@provider.purge_package("zsh", "4.2.7")
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should purge the currently active version if no explicit version is passed in" do
|
138
|
-
expect(@provider).to receive(:shell_out!).with("port uninstall zsh")
|
138
|
+
expect(@provider).to receive(:shell_out!).with("port uninstall zsh", timeout: 900)
|
139
139
|
@provider.purge_package("zsh", nil)
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should add options to the port command when specified" do
|
143
143
|
allow(@new_resource).to receive(:options).and_return("-f")
|
144
|
-
expect(@provider).to receive(:shell_out!).with("port -f uninstall zsh @4.2.7")
|
144
|
+
expect(@provider).to receive(:shell_out!).with("port -f uninstall zsh @4.2.7", timeout: 900)
|
145
145
|
@provider.purge_package("zsh", "4.2.7")
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "remove_package" do
|
150
150
|
it "should run the port deactivate command with the correct version" do
|
151
|
-
expect(@provider).to receive(:shell_out!).with("port deactivate zsh @4.2.7")
|
151
|
+
expect(@provider).to receive(:shell_out!).with("port deactivate zsh @4.2.7", timeout: 900)
|
152
152
|
@provider.remove_package("zsh", "4.2.7")
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should remove the currently active version if no explicit version is passed in" do
|
156
|
-
expect(@provider).to receive(:shell_out!).with("port deactivate zsh")
|
156
|
+
expect(@provider).to receive(:shell_out!).with("port deactivate zsh", timeout: 900)
|
157
157
|
@provider.remove_package("zsh", nil)
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should add options to the port command when specified" do
|
161
161
|
allow(@new_resource).to receive(:options).and_return("-f")
|
162
|
-
expect(@provider).to receive(:shell_out!).with("port -f deactivate zsh @4.2.7")
|
162
|
+
expect(@provider).to receive(:shell_out!).with("port -f deactivate zsh @4.2.7", timeout: 900)
|
163
163
|
@provider.remove_package("zsh", "4.2.7")
|
164
164
|
end
|
165
165
|
end
|
@@ -169,7 +169,7 @@ EOF
|
|
169
169
|
expect(@current_resource).to receive(:version).at_least(:once).and_return("4.1.6")
|
170
170
|
@provider.current_resource = @current_resource
|
171
171
|
|
172
|
-
expect(@provider).to receive(:shell_out!).with("port upgrade zsh @4.2.7")
|
172
|
+
expect(@provider).to receive(:shell_out!).with("port upgrade zsh @4.2.7", timeout: 900)
|
173
173
|
|
174
174
|
@provider.upgrade_package("zsh", "4.2.7")
|
175
175
|
end
|
@@ -195,7 +195,7 @@ EOF
|
|
195
195
|
expect(@current_resource).to receive(:version).at_least(:once).and_return("4.1.6")
|
196
196
|
@provider.current_resource = @current_resource
|
197
197
|
|
198
|
-
expect(@provider).to receive(:shell_out!).with("port -f upgrade zsh @4.2.7")
|
198
|
+
expect(@provider).to receive(:shell_out!).with("port -f upgrade zsh @4.2.7", timeout: 900)
|
199
199
|
|
200
200
|
@provider.upgrade_package("zsh", "4.2.7")
|
201
201
|
end
|
@@ -50,25 +50,13 @@ describe Chef::Provider::Package::Openbsd do
|
|
50
50
|
|
51
51
|
context 'when there is a single candidate' do
|
52
52
|
|
53
|
-
context 'when installing from source' do
|
54
|
-
it 'should run the installation command' do
|
55
|
-
pending('Installing from source is not supported yet')
|
56
|
-
# This is a consequence of load_current_resource being called before define_resource_requirements
|
57
|
-
# It can be deleted once an implementation is provided
|
58
|
-
allow(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}\"", anything()).and_return(
|
59
|
-
instance_double('shellout', :stdout => "#{name}-#{version}\n"))
|
60
|
-
new_resource.source('/some/path/on/disk.tgz')
|
61
|
-
provider.run_action(:install)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
53
|
context 'when source is not provided' do
|
66
54
|
it 'should run the installation command' do
|
67
55
|
expect(provider).to receive(:shell_out!).with("pkg_info -I \"#{name}\"", anything()).and_return(
|
68
56
|
instance_double('shellout', :stdout => "#{name}-#{version}\n"))
|
69
57
|
expect(provider).to receive(:shell_out!).with(
|
70
58
|
"pkg_add -r #{name}-#{version}",
|
71
|
-
{:env => {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}}
|
59
|
+
{:env => {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
|
72
60
|
) {OpenStruct.new :status => true}
|
73
61
|
provider.run_action(:install)
|
74
62
|
end
|
@@ -100,21 +88,12 @@ describe Chef::Provider::Package::Openbsd do
|
|
100
88
|
instance_double('shellout', :stdout => "#{name}-#{version}-#{flavor}\n"))
|
101
89
|
expect(provider).to receive(:shell_out!).with(
|
102
90
|
"pkg_add -r #{name}-#{version}-#{flavor}",
|
103
|
-
{:
|
91
|
+
{env: {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
|
104
92
|
) {OpenStruct.new :status => true}
|
105
93
|
provider.run_action(:install)
|
106
94
|
end
|
107
95
|
end
|
108
96
|
|
109
|
-
context 'if a version is specified' do
|
110
|
-
it 'runs the installation command' do
|
111
|
-
pending('Specifying both a version and flavor is not supported')
|
112
|
-
new_resource.version(version)
|
113
|
-
allow(provider).to receive(:shell_out!).with(/pkg_info -e/, anything()).and_return(instance_double('shellout', :stdout => ''))
|
114
|
-
allow(provider).to receive(:candidate_version).and_return("#{package_name}-#{version}-#{flavor}")
|
115
|
-
provider.run_action(:install)
|
116
|
-
end
|
117
|
-
end
|
118
97
|
end
|
119
98
|
|
120
99
|
context 'if a version is specified' do
|
@@ -125,7 +104,7 @@ describe Chef::Provider::Package::Openbsd do
|
|
125
104
|
new_resource.version("#{version}-#{flavor_b}")
|
126
105
|
expect(provider).to receive(:shell_out!).with(
|
127
106
|
"pkg_add -r #{name}-#{version}-#{flavor_b}",
|
128
|
-
{:
|
107
|
+
{env: {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
|
129
108
|
) {OpenStruct.new :status => true}
|
130
109
|
provider.run_action(:install)
|
131
110
|
end
|
@@ -144,11 +123,10 @@ describe Chef::Provider::Package::Openbsd do
|
|
144
123
|
end
|
145
124
|
it "should run the command to delete the installed package" do
|
146
125
|
expect(@provider).to receive(:shell_out!).with(
|
147
|
-
"pkg_delete #{@name}", :
|
126
|
+
"pkg_delete #{@name}", env: nil, timeout: 900
|
148
127
|
) {OpenStruct.new :status => true}
|
149
128
|
@provider.remove_package(@name, nil)
|
150
129
|
end
|
151
130
|
end
|
152
131
|
|
153
132
|
end
|
154
|
-
|
@@ -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 #{@new_resource.package_name}").and_return(@status)
|
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
|
|
@@ -152,12 +152,12 @@ PACMAN_CONF
|
|
152
152
|
|
153
153
|
describe Chef::Provider::Package::Pacman, "install_package" do
|
154
154
|
it "should run pacman install with the package name and version" do
|
155
|
-
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano")
|
155
|
+
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano", {timeout: 900})
|
156
156
|
@provider.install_package("nano", "1.0")
|
157
157
|
end
|
158
158
|
|
159
159
|
it "should run pacman install with the package name and version and options if specified" do
|
160
|
-
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano")
|
160
|
+
expect(@provider).to receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano", {timeout: 900})
|
161
161
|
allow(@new_resource).to receive(:options).and_return("--debug")
|
162
162
|
|
163
163
|
@provider.install_package("nano", "1.0")
|
@@ -173,12 +173,12 @@ PACMAN_CONF
|
|
173
173
|
|
174
174
|
describe Chef::Provider::Package::Pacman, "remove_package" do
|
175
175
|
it "should run pacman remove with the package name" do
|
176
|
-
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano")
|
176
|
+
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano", {timeout: 900})
|
177
177
|
@provider.remove_package("nano", "1.0")
|
178
178
|
end
|
179
179
|
|
180
180
|
it "should run pacman remove with the package name and options if specified" do
|
181
|
-
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano")
|
181
|
+
expect(@provider).to receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano", {timeout: 900})
|
182
182
|
allow(@new_resource).to receive(:options).and_return("--debug")
|
183
183
|
|
184
184
|
@provider.remove_package("nano", "1.0")
|
@@ -57,16 +57,16 @@ describe Chef::Provider::Package::Rpm do
|
|
57
57
|
let(:stdout) { "ImageMagick-c++ 6.5.4.7-7.el6_5" }
|
58
58
|
|
59
59
|
it "should get the source package version from rpm if provided" do
|
60
|
-
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm").and_return(status)
|
61
|
-
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' ImageMagick-c++").and_return(status)
|
60
|
+
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900).and_return(status)
|
61
|
+
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' ImageMagick-c++", timeout: 900).and_return(status)
|
62
62
|
provider.load_current_resource
|
63
63
|
expect(provider.current_resource.package_name).to eq("ImageMagick-c++")
|
64
64
|
expect(provider.new_resource.version).to eq("6.5.4.7-7.el6_5")
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should return the current version installed if found by rpm" do
|
68
|
-
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm").and_return(status)
|
69
|
-
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' ImageMagick-c++").and_return(status)
|
68
|
+
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900).and_return(status)
|
69
|
+
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' ImageMagick-c++", timeout: 900).and_return(status)
|
70
70
|
provider.load_current_resource
|
71
71
|
expect(provider.current_resource.version).to eq("6.5.4.7-7.el6_5")
|
72
72
|
end
|
@@ -121,8 +121,8 @@ describe Chef::Provider::Package::Rpm do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should not detect the package name as version when not installed" do
|
124
|
-
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass").and_return(status)
|
125
|
-
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass").and_return(status)
|
124
|
+
expect(provider).to receive(:shell_out!).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass", timeout: 900).and_return(status)
|
125
|
+
expect(provider).to receive(:shell_out).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass", timeout: 900).and_return(status)
|
126
126
|
provider.load_current_resource
|
127
127
|
expect(provider.current_resource.version).to be_nil
|
128
128
|
end
|
@@ -139,19 +139,19 @@ describe Chef::Provider::Package::Rpm do
|
|
139
139
|
|
140
140
|
describe "when installing or upgrading" do
|
141
141
|
it "should run rpm -i with the package source to install" do
|
142
|
-
expect(provider).to receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
142
|
+
expect(provider).to receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
143
143
|
provider.install_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should run rpm -U with the package source to upgrade" do
|
147
147
|
current_resource.version("21.4-19.el5")
|
148
|
-
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
148
|
+
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
149
149
|
provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should install package if missing and set to upgrade" do
|
153
153
|
current_resource.version("ImageMagick-c++")
|
154
|
-
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
154
|
+
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
155
155
|
provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
|
156
156
|
end
|
157
157
|
|
@@ -162,7 +162,7 @@ describe Chef::Provider::Package::Rpm do
|
|
162
162
|
it "should run rpm -U --oldpackage with the package source to downgrade" do
|
163
163
|
new_resource.allow_downgrade(true)
|
164
164
|
current_resource.version("21.4-19.el5")
|
165
|
-
expect(provider).to receive(:shell_out!).with("rpm -U --oldpackage /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
165
|
+
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)
|
166
166
|
provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
|
167
167
|
end
|
168
168
|
end
|
@@ -174,7 +174,7 @@ describe Chef::Provider::Package::Rpm do
|
|
174
174
|
it "should install from a path when the package is a path and the source is nil" do
|
175
175
|
expect(new_resource.source).to eq("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
176
176
|
provider.current_resource = current_resource
|
177
|
-
expect(provider).to receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
177
|
+
expect(provider).to receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
178
178
|
provider.install_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
|
179
179
|
end
|
180
180
|
|
@@ -182,7 +182,7 @@ describe Chef::Provider::Package::Rpm do
|
|
182
182
|
expect(new_resource.source).to eq("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
183
183
|
current_resource.version("21.4-19.el5")
|
184
184
|
provider.current_resource = current_resource
|
185
|
-
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
185
|
+
expect(provider).to receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
186
186
|
provider.upgrade_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
|
187
187
|
end
|
188
188
|
end
|
@@ -190,14 +190,14 @@ describe Chef::Provider::Package::Rpm do
|
|
190
190
|
it "installs with custom options specified in the resource" do
|
191
191
|
provider.candidate_version = '11'
|
192
192
|
new_resource.options("--dbpath /var/lib/rpm")
|
193
|
-
expect(provider).to receive(:shell_out!).with("rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
|
193
|
+
expect(provider).to receive(:shell_out!).with("rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", timeout: 900)
|
194
194
|
provider.install_package(new_resource.name, provider.candidate_version)
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
198
|
describe "when removing the package" do
|
199
199
|
it "should run rpm -e to remove the package" do
|
200
|
-
expect(provider).to receive(:shell_out!).with("rpm -e ImageMagick-c++-6.5.4.7-7.el6_5")
|
200
|
+
expect(provider).to receive(:shell_out!).with("rpm -e ImageMagick-c++-6.5.4.7-7.el6_5", timeout: 900)
|
201
201
|
provider.remove_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
|
202
202
|
end
|
203
203
|
end
|
@@ -107,38 +107,6 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
|
|
107
107
|
expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0'))
|
108
108
|
end
|
109
109
|
|
110
|
-
context "when rubygems was upgraded from 1.8->2.0" do
|
111
|
-
# https://github.com/rubygems/rubygems/issues/404
|
112
|
-
# tl;dr rubygems 1.8 and 2.0 can both be in the load path, which means that
|
113
|
-
# require "rubygems/format" will load even though rubygems 2.0 doesn't have
|
114
|
-
# that file.
|
115
|
-
|
116
|
-
before do
|
117
|
-
if defined?(Gem::Format)
|
118
|
-
# tests are running under rubygems 1.8, or 2.0 upgraded from 1.8
|
119
|
-
@remove_gem_format = false
|
120
|
-
else
|
121
|
-
Gem.const_set(:Format, Object.new)
|
122
|
-
@remove_gem_format = true
|
123
|
-
end
|
124
|
-
allow(Gem::Package).to receive(:respond_to?).and_call_original
|
125
|
-
allow(Gem::Package).to receive(:respond_to?).with(:open).and_return(false)
|
126
|
-
end
|
127
|
-
|
128
|
-
after do
|
129
|
-
if @remove_gem_format
|
130
|
-
Gem.send(:remove_const, :Format)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
it "finds a matching gem candidate version on rubygems 2.0+ with some rubygems 1.8 code loaded" do
|
135
|
-
package = double("Gem::Package", :spec => "a gemspec from package")
|
136
|
-
expect(Gem::Package).to receive(:new).with("/path/to/package.gem").and_return(package)
|
137
|
-
expect(@gem_env.spec_from_file("/path/to/package.gem")).to eq("a gemspec from package")
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
110
|
it "gives the candidate version as nil if none is found" do
|
143
111
|
dep = Gem::Dependency.new('rspec', '>= 0')
|
144
112
|
latest = []
|
@@ -222,8 +190,6 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
|
|
222
190
|
end
|
223
191
|
|
224
192
|
it "uses the cached result for gem paths when available" do
|
225
|
-
gem_env_output = ['/path/to/gems', '/another/path/to/gems'].join(File::PATH_SEPARATOR)
|
226
|
-
shell_out_result = OpenStruct.new(:stdout => gem_env_output)
|
227
193
|
expect(@gem_env).not_to receive(:shell_out!)
|
228
194
|
expected = ['/path/to/gems', '/another/path/to/gems']
|
229
195
|
Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache['/usr/weird/bin/gem']= expected
|
@@ -261,7 +227,7 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
|
|
261
227
|
else
|
262
228
|
`which gem`.strip
|
263
229
|
end
|
264
|
-
|
230
|
+
skip("cant find your gem executable") if path_to_gem.empty?
|
265
231
|
gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new(path_to_gem)
|
266
232
|
expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)]
|
267
233
|
actual = gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil)).map { |s| [s.name, s.version] }
|
@@ -542,7 +508,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
542
508
|
it "installs the gem by shelling out when options are provided as a String" do
|
543
509
|
@new_resource.options('-i /alt/install/location')
|
544
510
|
expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" -i /alt/install/location"
|
545
|
-
expect(@provider).to receive(:shell_out!).with(expected, :
|
511
|
+
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
|
546
512
|
@provider.run_action(:install)
|
547
513
|
expect(@new_resource).to be_updated_by_last_action
|
548
514
|
end
|
@@ -551,7 +517,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
551
517
|
@new_resource.gem_binary('/foo/bar')
|
552
518
|
@new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby')
|
553
519
|
expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --source=#{@new_resource.source} --source=https://rubygems.org"
|
554
|
-
expect(@provider).to receive(:shell_out!).with(expected, :
|
520
|
+
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
|
555
521
|
@provider.run_action(:install)
|
556
522
|
expect(@new_resource).to be_updated_by_last_action
|
557
523
|
end
|
@@ -561,7 +527,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
561
527
|
@new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby')
|
562
528
|
@new_resource.clear_sources(true)
|
563
529
|
expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --clear-sources --source=#{@new_resource.source}"
|
564
|
-
expect(@provider).to receive(:shell_out!).with(expected, :
|
530
|
+
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
|
565
531
|
@provider.run_action(:install)
|
566
532
|
expect(@new_resource).to be_updated_by_last_action
|
567
533
|
end
|
@@ -572,7 +538,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
572
538
|
it "installs the gem by shelling out when options are provided but no version is given" do
|
573
539
|
@new_resource.options('-i /alt/install/location')
|
574
540
|
expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@provider.candidate_version}\" -i /alt/install/location"
|
575
|
-
expect(@provider).to receive(:shell_out!).with(expected, :
|
541
|
+
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
|
576
542
|
@provider.run_action(:install)
|
577
543
|
expect(@new_resource).to be_updated_by_last_action
|
578
544
|
end
|
@@ -618,7 +584,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
618
584
|
describe "in an alternate gem environment" do
|
619
585
|
it "installs the gem by shelling out to gem install" do
|
620
586
|
@new_resource.gem_binary('/usr/weird/bin/gem')
|
621
|
-
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", :
|
587
|
+
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", env: nil, timeout: 900)
|
622
588
|
@provider.run_action(:install)
|
623
589
|
expect(@new_resource).to be_updated_by_last_action
|
624
590
|
end
|
@@ -627,7 +593,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
627
593
|
@new_resource.gem_binary('/usr/weird/bin/gem')
|
628
594
|
@new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
|
629
595
|
@new_resource.version('>= 0')
|
630
|
-
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :
|
596
|
+
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900)
|
631
597
|
@provider.run_action(:install)
|
632
598
|
expect(@new_resource).to be_updated_by_last_action
|
633
599
|
end
|
@@ -639,7 +605,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
639
605
|
@new_resource.gem_binary('/usr/weird/bin/gem')
|
640
606
|
@new_resource.version('>= 0')
|
641
607
|
expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
|
642
|
-
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :
|
608
|
+
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900)
|
643
609
|
@provider.run_action(:install)
|
644
610
|
expect(@new_resource).to be_updated_by_last_action
|
645
611
|
end
|
@@ -678,7 +644,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
678
644
|
|
679
645
|
it "uninstalls via the gem command when options are given as a String" do
|
680
646
|
@new_resource.options('-i /alt/install/location')
|
681
|
-
expect(@provider).to receive(:shell_out!).with("gem uninstall rspec -q -x -I -a -i /alt/install/location", :
|
647
|
+
expect(@provider).to receive(:shell_out!).with("gem uninstall rspec -q -x -I -a -i /alt/install/location", env: nil, timeout: 900)
|
682
648
|
@provider.action_remove
|
683
649
|
end
|
684
650
|
|
@@ -692,7 +658,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
692
658
|
describe "in an alternate gem environment" do
|
693
659
|
it "uninstalls via the gem command" do
|
694
660
|
@new_resource.gem_binary('/usr/weird/bin/gem')
|
695
|
-
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem uninstall rspec -q -x -I -a", :
|
661
|
+
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem uninstall rspec -q -x -I -a", env: nil, timeout: 900)
|
696
662
|
@provider.action_remove
|
697
663
|
end
|
698
664
|
end
|
@@ -82,7 +82,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
82
82
|
and_yield("something-varnish-1.1.1 something varnish like\n").
|
83
83
|
and_yield("varnish-2.3.4 actual varnish\n")
|
84
84
|
@shell_out = double('shell_out!', :stdout => search)
|
85
|
-
expect(@provider).to receive(:shell_out!).with('/opt/local/bin/pkgin', 'se', 'varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
|
85
|
+
expect(@provider).to receive(:shell_out!).with('/opt/local/bin/pkgin', 'se', 'varnish', :env => nil, :returns => [0,1], :timeout=>900).and_return(@shell_out)
|
86
86
|
expect(@provider.candidate_version).to eq("2.3.4")
|
87
87
|
end
|
88
88
|
|
@@ -92,7 +92,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
92
92
|
and_yield("something-varnish-1.1.1;;something varnish like\n").
|
93
93
|
and_yield("varnish-2.3.4;;actual varnish\n")
|
94
94
|
@shell_out = double('shell_out!', :stdout => search)
|
95
|
-
expect(@provider).to receive(:shell_out!).with('/opt/local/bin/pkgin', 'se', 'varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
|
95
|
+
expect(@provider).to receive(:shell_out!).with('/opt/local/bin/pkgin', 'se', 'varnish', :env => nil, :returns => [0,1], :timeout=>900).and_return(@shell_out)
|
96
96
|
expect(@provider.candidate_version).to eq("2.3.4")
|
97
97
|
end
|
98
98
|
end
|
@@ -101,8 +101,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
101
101
|
|
102
102
|
it "run pkgin and install the package" do
|
103
103
|
out = OpenStruct.new(:stdout => nil)
|
104
|
-
expect(@provider).to receive(:shell_out!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", {:env => nil, :returns=>[0,1]}).and_return(@shell_out)
|
105
|
-
expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", {:env=>nil}).and_return(out)
|
104
|
+
expect(@provider).to receive(:shell_out!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", {:env => nil, :returns=>[0,1], :timeout=>900}).and_return(@shell_out)
|
105
|
+
expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", {:env=>nil, :timeout=>900}).and_return(out)
|
106
106
|
@provider.load_current_resource
|
107
107
|
@provider.install_package("varnish", "2.1.5nb2")
|
108
108
|
end
|
@@ -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").and_return(status)
|
75
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash").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").and_return(@status)
|
85
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash").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").and_return(@status)
|
105
|
-
expect(@provider).to receive(:shell_out).with("pkginfo -l SUNWbash").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")
|
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")
|
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
148
|
allow(@new_resource).to receive(:options).and_return("-a /tmp/myadmin")
|
149
|
-
expect(@provider).to receive(:shell_out!).with("pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all")
|
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")
|
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
161
|
allow(@new_resource).to receive(:options).and_return("-a /tmp/myadmin")
|
162
|
-
expect(@provider).to receive(:shell_out!).with("pkgrm -n -a /tmp/myadmin SUNWbash")
|
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
|
|