chef 12.18.31-universal-mingw32 → 12.19.33-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +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
@@ -595,7 +595,7 @@ describe Chef::Provider::Deploy do
|
|
595
595
|
|
596
596
|
callback_code = Proc.new do
|
597
597
|
snitch = 42
|
598
|
-
temp_collection =
|
598
|
+
temp_collection = resource_collection
|
599
599
|
run("tehMice")
|
600
600
|
snitch = temp_collection.lookup("execute[tehMice]")
|
601
601
|
end
|
@@ -148,6 +148,16 @@ describe Chef::Provider::Directory do
|
|
148
148
|
directory.run_action(:create)
|
149
149
|
expect(new_resource).not_to be_updated
|
150
150
|
end
|
151
|
+
|
152
|
+
context "in why run mode" do
|
153
|
+
before { Chef::Config[:why_run] = true }
|
154
|
+
after { Chef::Config[:why_run] = false }
|
155
|
+
|
156
|
+
it "does not modify new_resource" do
|
157
|
+
expect(directory).not_to receive(:load_resource_attributes_from_file).with(new_resource)
|
158
|
+
directory.run_action(:create)
|
159
|
+
end
|
160
|
+
end
|
151
161
|
end
|
152
162
|
|
153
163
|
describe "when the directory does not exist" do
|
@@ -165,4 +165,179 @@ describe Chef::Provider::DscResource do
|
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
168
|
+
|
169
|
+
describe "define_resource_requirements" do
|
170
|
+
let (:node) do
|
171
|
+
set_node_object
|
172
|
+
end
|
173
|
+
|
174
|
+
context "module usage is valid" do
|
175
|
+
before do
|
176
|
+
allow(provider).to receive(:module_usage_valid?).and_return(true)
|
177
|
+
allow(provider).to receive(:action_run)
|
178
|
+
end
|
179
|
+
|
180
|
+
[:run].each do |action|
|
181
|
+
context "action #{action}" do
|
182
|
+
it "does not raise the exception" do
|
183
|
+
expect { provider.run_action(action) }.not_to raise_error
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context "module usage is invalid" do
|
190
|
+
before do
|
191
|
+
allow(provider).to receive(:module_usage_valid?).and_return(false)
|
192
|
+
allow(provider).to receive(:action_run)
|
193
|
+
end
|
194
|
+
|
195
|
+
[:run].each do |action|
|
196
|
+
context "action #{action}" do
|
197
|
+
it "raises the exception" do
|
198
|
+
expect { provider.run_action(action) }.to raise_error(
|
199
|
+
Chef::Exceptions::DSCModuleNameMissing
|
200
|
+
)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
describe "module_usage_valid?" do
|
208
|
+
let (:node) do
|
209
|
+
set_node_object
|
210
|
+
end
|
211
|
+
|
212
|
+
context "module_name and module_version both are not provided" do
|
213
|
+
before do
|
214
|
+
provider.instance_variable_set(:@module_name, nil)
|
215
|
+
provider.instance_variable_set(:@module_version, nil)
|
216
|
+
end
|
217
|
+
|
218
|
+
it "returns true" do
|
219
|
+
response = provider.send(:module_usage_valid?)
|
220
|
+
expect(response).to be == true
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context "module_name and module_version both are provided" do
|
225
|
+
before do
|
226
|
+
provider.instance_variable_set(:@module_name, "my_module")
|
227
|
+
provider.instance_variable_set(:@module_version, "1.3")
|
228
|
+
end
|
229
|
+
|
230
|
+
it "returns true" do
|
231
|
+
response = provider.send(:module_usage_valid?)
|
232
|
+
expect(response).to be == true
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "module_name is given but module_version is not given" do
|
237
|
+
before do
|
238
|
+
provider.instance_variable_set(:@module_name, "my_module")
|
239
|
+
provider.instance_variable_set(:@module_version, nil)
|
240
|
+
end
|
241
|
+
|
242
|
+
it "returns true" do
|
243
|
+
response = provider.send(:module_usage_valid?)
|
244
|
+
expect(response).to be == true
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
context "module_name is not given but module_version is given" do
|
249
|
+
before do
|
250
|
+
provider.instance_variable_set(:@module_name, nil)
|
251
|
+
provider.instance_variable_set(:@module_version, "1.4.0.1")
|
252
|
+
end
|
253
|
+
|
254
|
+
it "returns false" do
|
255
|
+
response = provider.send(:module_usage_valid?)
|
256
|
+
expect(response).to be == false
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
describe "module_info_object" do
|
262
|
+
let (:node) do
|
263
|
+
set_node_object
|
264
|
+
end
|
265
|
+
|
266
|
+
context "module_version is not given" do
|
267
|
+
before do
|
268
|
+
provider.instance_variable_set(:@module_version, nil)
|
269
|
+
allow(provider).to receive(:module_name).and_return("my_module")
|
270
|
+
end
|
271
|
+
|
272
|
+
it "returns only name of the module" do
|
273
|
+
response = provider.send(:module_info_object)
|
274
|
+
expect(response).to be == "my_module"
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
context "module_version is given" do
|
279
|
+
before do
|
280
|
+
provider.instance_variable_set(:@module_version, "1.3.1")
|
281
|
+
allow(provider).to receive(:module_name).and_return("my_module")
|
282
|
+
end
|
283
|
+
|
284
|
+
it "returns the module info object" do
|
285
|
+
response = provider.send(:module_info_object)
|
286
|
+
expect(response).to be == "@{ModuleName='my_module';ModuleVersion='1.3.1'}"
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
describe "invoke_resource" do
|
292
|
+
let (:node) do
|
293
|
+
set_node_object
|
294
|
+
end
|
295
|
+
|
296
|
+
let(:cmdlet) { double(:run! => nil) }
|
297
|
+
|
298
|
+
before(:each) do
|
299
|
+
allow(provider).to receive(:translate_type).and_return("my_properties")
|
300
|
+
provider.instance_variable_set(:@new_resource, double(
|
301
|
+
:properties => "my_properties", :resource => "my_resource", :timeout => 123
|
302
|
+
))
|
303
|
+
end
|
304
|
+
|
305
|
+
context "when module_version is not given" do
|
306
|
+
before do
|
307
|
+
allow(provider).to receive(:module_info_object).and_return("my_module")
|
308
|
+
end
|
309
|
+
|
310
|
+
it "invokes Invoke-DscResource command with module name" do
|
311
|
+
expect(Chef::Util::Powershell::Cmdlet).to receive(:new).with(
|
312
|
+
node,
|
313
|
+
"Invoke-DscResource -Method my_method -Name my_resource -Property my_properties -Module my_module -Verbose",
|
314
|
+
"my_output_format"
|
315
|
+
).and_return(cmdlet)
|
316
|
+
provider.send(:invoke_resource, "my_method", "my_output_format")
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
context "when module_version is given" do
|
321
|
+
before do
|
322
|
+
allow(provider).to receive(:module_info_object).and_return(
|
323
|
+
"@{ModuleName='my_module';ModuleVersion='my_module_version'}"
|
324
|
+
)
|
325
|
+
end
|
326
|
+
|
327
|
+
it "invokes Invoke-DscResource command with module info object" do
|
328
|
+
expect(Chef::Util::Powershell::Cmdlet).to receive(:new).with(
|
329
|
+
node,
|
330
|
+
"Invoke-DscResource -Method my_method -Name my_resource -Property my_properties -Module @{ModuleName='my_module';ModuleVersion='my_module_version'} -Verbose",
|
331
|
+
"my_output_format"
|
332
|
+
).and_return(cmdlet)
|
333
|
+
provider.send(:invoke_resource, "my_method", "my_output_format")
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
def set_node_object
|
340
|
+
node = Chef::Node.new
|
341
|
+
node.automatic[:languages][:powershell][:version] = "5.0.10586.0"
|
342
|
+
node
|
168
343
|
end
|
@@ -185,8 +185,8 @@ XML
|
|
185
185
|
end
|
186
186
|
|
187
187
|
describe "hash is passed" do
|
188
|
-
it "should produce the test_plist from the
|
189
|
-
new_resource.
|
188
|
+
it "should produce the test_plist content from the plist_hash property" do
|
189
|
+
new_resource.plist_hash test_hash
|
190
190
|
expect(provider.content?).to be_truthy
|
191
191
|
expect(provider.content).to eql(test_plist)
|
192
192
|
end
|
@@ -28,7 +28,7 @@ describe Chef::Provider::Package::Aix do
|
|
28
28
|
@new_resource.source("/tmp/samba.base")
|
29
29
|
|
30
30
|
@provider = Chef::Provider::Package::Aix.new(@new_resource, @run_context)
|
31
|
-
allow(::File).to receive(:
|
31
|
+
allow(::File).to receive(:exist?).with(@new_resource.source).and_return(true)
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "assessing the current package status" do
|
@@ -41,23 +41,23 @@ describe Chef::Provider::Package::Aix do
|
|
41
41
|
|
42
42
|
it "should create a current resource with the name of new_resource" do
|
43
43
|
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
|
44
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
45
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
|
44
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
45
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
|
46
46
|
@provider.load_current_resource
|
47
47
|
expect(@provider.current_resource.name).to eq("samba.base")
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should set the current resource bff package name to the new resource bff package name" do
|
51
51
|
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
|
52
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
53
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
|
52
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
53
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
|
54
54
|
@provider.load_current_resource
|
55
55
|
expect(@provider.current_resource.package_name).to eq("samba.base")
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should raise an exception if a source is supplied but not found" do
|
59
59
|
allow(@provider).to receive(:shell_out).and_return(@empty_status)
|
60
|
-
allow(::File).to receive(:
|
60
|
+
allow(::File).to receive(:exist?).with(@new_resource.source).and_return(false)
|
61
61
|
@provider.load_current_resource
|
62
62
|
@provider.define_resource_requirements
|
63
63
|
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Package)
|
@@ -65,8 +65,8 @@ describe Chef::Provider::Package::Aix do
|
|
65
65
|
|
66
66
|
it "should get the source package version from lslpp if provided" do
|
67
67
|
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
|
68
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
69
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
|
68
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
69
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
|
70
70
|
@provider.load_current_resource
|
71
71
|
|
72
72
|
expect(@provider.current_resource.package_name).to eq("samba.base")
|
@@ -77,8 +77,8 @@ describe Chef::Provider::Package::Aix do
|
|
77
77
|
info = "samba.base:samba.base.samples:3.3.12.0::COMMITTED:I:Samba for AIX:
|
78
78
|
/etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
|
79
79
|
status = double("Status", :stdout => info, :exitstatus => 0)
|
80
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
81
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
|
80
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
81
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
|
82
82
|
expect(Chef::Log).to receive(:warn).once.with(%r{bff package by product name})
|
83
83
|
@provider.load_current_resource
|
84
84
|
|
@@ -90,8 +90,8 @@ describe Chef::Provider::Package::Aix do
|
|
90
90
|
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
|
91
91
|
@stdout = StringIO.new(@bffinfo)
|
92
92
|
@stdin, @stderr = StringIO.new, StringIO.new
|
93
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
94
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(status)
|
93
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
94
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(status)
|
95
95
|
@provider.load_current_resource
|
96
96
|
expect(@provider.current_resource.version).to eq("3.3.12.0")
|
97
97
|
end
|
@@ -112,8 +112,8 @@ describe Chef::Provider::Package::Aix do
|
|
112
112
|
|
113
113
|
it "should return a current resource with a nil version if the package is not found" do
|
114
114
|
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
|
115
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
116
|
-
expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
|
115
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
116
|
+
expect(@provider).to receive(:shell_out).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
|
117
117
|
@provider.load_current_resource
|
118
118
|
expect(@provider.current_resource.version).to be_nil
|
119
119
|
end
|
@@ -122,7 +122,7 @@ describe Chef::Provider::Package::Aix do
|
|
122
122
|
wrongbffinfo = "/usr/lib/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:
|
123
123
|
/etc/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:"
|
124
124
|
status = double("Status", :stdout => wrongbffinfo, :exitstatus => 0)
|
125
|
-
expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
|
125
|
+
expect(@provider).to receive(:shell_out).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
|
126
126
|
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
|
127
127
|
end
|
128
128
|
end
|
@@ -130,7 +130,7 @@ describe Chef::Provider::Package::Aix do
|
|
130
130
|
describe "candidate_version" do
|
131
131
|
it "should return the candidate_version variable if already setup" do
|
132
132
|
@provider.candidate_version = "3.3.12.0"
|
133
|
-
expect(@provider).not_to receive(:shell_out
|
133
|
+
expect(@provider).not_to receive(:shell_out)
|
134
134
|
@provider.candidate_version
|
135
135
|
end
|
136
136
|
|
@@ -150,34 +150,34 @@ describe Chef::Provider::Package::Aix do
|
|
150
150
|
|
151
151
|
describe "install and upgrade" do
|
152
152
|
it "should run installp -aYF -d with the package source to install" do
|
153
|
-
expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base", timeout: 900)
|
153
|
+
expect(@provider).to receive(:shell_out!).with("installp", "-aYF", "-d", "/tmp/samba.base", "samba.base", timeout: 900)
|
154
154
|
@provider.install_package("samba.base", "3.3.12.0")
|
155
155
|
end
|
156
156
|
|
157
|
-
it "should run
|
157
|
+
it "should run installp -aYF -d when the package is a path to install" do
|
158
158
|
@new_resource = Chef::Resource::Package.new("/tmp/samba.base")
|
159
159
|
@provider = Chef::Provider::Package::Aix.new(@new_resource, @run_context)
|
160
160
|
expect(@new_resource.source).to eq("/tmp/samba.base")
|
161
|
-
expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base", timeout: 900)
|
161
|
+
expect(@provider).to receive(:shell_out!).with("installp", "-aYF", "-d", "/tmp/samba.base", "/tmp/samba.base", timeout: 900)
|
162
162
|
@provider.install_package("/tmp/samba.base", "3.3.12.0")
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should run installp with -eLogfile option." do
|
166
166
|
allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log")
|
167
|
-
expect(@provider).to receive(:shell_out!).with("installp -aYF
|
167
|
+
expect(@provider).to receive(:shell_out!).with("installp", "-aYF", "-e/tmp/installp.log", "-d", "/tmp/samba.base", "samba.base", timeout: 900)
|
168
168
|
@provider.install_package("samba.base", "3.3.12.0")
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
172
|
describe "remove" do
|
173
173
|
it "should run installp -u samba.base to remove the package" do
|
174
|
-
expect(@provider).to receive(:shell_out!).with("installp -u samba.base", timeout: 900)
|
174
|
+
expect(@provider).to receive(:shell_out!).with("installp", "-u", "samba.base", timeout: 900)
|
175
175
|
@provider.remove_package("samba.base", "3.3.12.0")
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should run installp -u -e/tmp/installp.log with options -e/tmp/installp.log" do
|
179
179
|
allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log")
|
180
|
-
expect(@provider).to receive(:shell_out!).with("installp -u
|
180
|
+
expect(@provider).to receive(:shell_out!).with("installp", "-u", "-e/tmp/installp.log", "samba.base", timeout: 900)
|
181
181
|
@provider.remove_package("samba.base", "3.3.12.0")
|
182
182
|
end
|
183
183
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-2017, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -51,7 +51,7 @@ irssi:
|
|
51
51
|
|
52
52
|
it "should create a current resource with the name of the new_resource" do
|
53
53
|
expect(@provider).to receive(:shell_out!).with(
|
54
|
-
"apt-cache policy
|
54
|
+
"apt-cache", "policy", @new_resource.package_name,
|
55
55
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
56
56
|
:timeout => @timeout
|
57
57
|
).and_return(@shell_out)
|
@@ -91,7 +91,7 @@ N: Unable to locate package conic-smarms
|
|
91
91
|
POLICY_STDOUT
|
92
92
|
policy = double(:stdout => policy_out, :exitstatus => 0)
|
93
93
|
expect(@provider).to receive(:shell_out!).with(
|
94
|
-
"apt-cache policy conic-smarms",
|
94
|
+
"apt-cache", "policy", "conic-smarms",
|
95
95
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
96
96
|
:timeout => @timeout
|
97
97
|
).and_return(policy)
|
@@ -100,7 +100,7 @@ N: Unable to locate package conic-smarms
|
|
100
100
|
SHOWPKG_STDOUT
|
101
101
|
showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
|
102
102
|
expect(@provider).to receive(:shell_out!).with(
|
103
|
-
"apt-cache showpkg conic-smarms",
|
103
|
+
"apt-cache", "showpkg", "conic-smarms",
|
104
104
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
105
105
|
:timeout => @timeout
|
106
106
|
).and_return(showpkg)
|
@@ -119,7 +119,7 @@ libmysqlclient15-dev:
|
|
119
119
|
VPKG_STDOUT
|
120
120
|
virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
|
121
121
|
expect(@provider).to receive(:shell_out!).with(
|
122
|
-
"apt-cache policy libmysqlclient15-dev",
|
122
|
+
"apt-cache", "policy", "libmysqlclient15-dev",
|
123
123
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
124
124
|
:timeout => @timeout
|
125
125
|
).and_return(virtual_package)
|
@@ -143,7 +143,7 @@ libmysqlclient-dev 5.1.41-3ubuntu12
|
|
143
143
|
SHOWPKG_STDOUT
|
144
144
|
showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
|
145
145
|
expect(@provider).to receive(:shell_out!).with(
|
146
|
-
"apt-cache showpkg libmysqlclient15-dev",
|
146
|
+
"apt-cache", "showpkg", "libmysqlclient15-dev",
|
147
147
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
148
148
|
:timeout => @timeout
|
149
149
|
).and_return(showpkg)
|
@@ -162,7 +162,7 @@ libmysqlclient-dev:
|
|
162
162
|
RPKG_STDOUT
|
163
163
|
real_package = double(:stdout => real_package_out, :exitstatus => 0)
|
164
164
|
expect(@provider).to receive(:shell_out!).with(
|
165
|
-
"apt-cache policy libmysqlclient-dev",
|
165
|
+
"apt-cache", "policy", "libmysqlclient-dev",
|
166
166
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
167
167
|
:timeout => @timeout
|
168
168
|
).and_return(real_package)
|
@@ -179,7 +179,7 @@ mp3-decoder:
|
|
179
179
|
VPKG_STDOUT
|
180
180
|
virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
|
181
181
|
expect(@provider).to receive(:shell_out!).with(
|
182
|
-
"apt-cache policy mp3-decoder",
|
182
|
+
"apt-cache", "policy", "mp3-decoder",
|
183
183
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
184
184
|
:timeout => @timeout
|
185
185
|
).and_return(virtual_package)
|
@@ -206,7 +206,7 @@ mpg123 1.12.1-0ubuntu1
|
|
206
206
|
SHOWPKG_STDOUT
|
207
207
|
showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
|
208
208
|
expect(@provider).to receive(:shell_out!).with(
|
209
|
-
"apt-cache showpkg mp3-decoder",
|
209
|
+
"apt-cache", "showpkg", "mp3-decoder",
|
210
210
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
211
211
|
:timeout => @timeout
|
212
212
|
).and_return(showpkg)
|
@@ -220,7 +220,7 @@ mpg123 1.12.1-0ubuntu1
|
|
220
220
|
allow(@new_resource).to receive(:default_release).and_return("lenny-backports")
|
221
221
|
allow(@new_resource).to receive(:provider).and_return(nil)
|
222
222
|
expect(@provider).to receive(:shell_out!).with(
|
223
|
-
"apt-cache -o APT::Default-Release=lenny-backports policy irssi",
|
223
|
+
"apt-cache", "-o", "APT::Default-Release=lenny-backports", "policy", "irssi",
|
224
224
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
225
225
|
:timeout => @timeout
|
226
226
|
).and_return(@shell_out)
|
@@ -230,7 +230,7 @@ mpg123 1.12.1-0ubuntu1
|
|
230
230
|
it "raises an exception if a source is specified (CHEF-5113)" do
|
231
231
|
@new_resource.source "pluto"
|
232
232
|
expect(@provider).to receive(:shell_out!).with(
|
233
|
-
"apt-cache policy
|
233
|
+
"apt-cache", "policy", @new_resource.package_name,
|
234
234
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" } ,
|
235
235
|
:timeout => @timeout
|
236
236
|
).and_return(@shell_out)
|
@@ -259,7 +259,7 @@ mpg123 1.12.1-0ubuntu1
|
|
259
259
|
describe "install_package" do
|
260
260
|
it "should run apt-get install with the package name and version" do
|
261
261
|
expect(@provider).to receive(:shell_out!). with(
|
262
|
-
"apt-get -q -y install irssi=0.8.12-7",
|
262
|
+
"apt-get", "-q", "-y", "install", "irssi=0.8.12-7",
|
263
263
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
264
264
|
:timeout => @timeout
|
265
265
|
)
|
@@ -268,7 +268,7 @@ mpg123 1.12.1-0ubuntu1
|
|
268
268
|
|
269
269
|
it "should run apt-get install with the package name and version and options if specified" do
|
270
270
|
expect(@provider).to receive(:shell_out!).with(
|
271
|
-
"apt-get -q -y --force-yes install irssi=0.8.12-7",
|
271
|
+
"apt-get", "-q", "-y", "--force-yes", "install", "irssi=0.8.12-7",
|
272
272
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
273
273
|
:timeout => @timeout
|
274
274
|
)
|
@@ -284,7 +284,7 @@ mpg123 1.12.1-0ubuntu1
|
|
284
284
|
@provider.new_resource = @new_resource
|
285
285
|
|
286
286
|
expect(@provider).to receive(:shell_out!).with(
|
287
|
-
"apt-get -q -y -o APT::Default-Release=lenny-backports install irssi=0.8.12-7",
|
287
|
+
"apt-get", "-q", "-y", "-o", "APT::Default-Release=lenny-backports", "install", "irssi=0.8.12-7",
|
288
288
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
289
289
|
:timeout => @timeout
|
290
290
|
)
|
@@ -305,7 +305,7 @@ mpg123 1.12.1-0ubuntu1
|
|
305
305
|
|
306
306
|
it "should run apt-get remove with the package name" do
|
307
307
|
expect(@provider).to receive(:shell_out!).with(
|
308
|
-
"apt-get -q -y remove irssi",
|
308
|
+
"apt-get", "-q", "-y", "remove", "irssi",
|
309
309
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
310
310
|
:timeout => @timeout
|
311
311
|
)
|
@@ -314,7 +314,7 @@ mpg123 1.12.1-0ubuntu1
|
|
314
314
|
|
315
315
|
it "should run apt-get remove with the package name and options if specified" do
|
316
316
|
expect(@provider).to receive(:shell_out!).with(
|
317
|
-
"apt-get -q -y --force-yes remove irssi",
|
317
|
+
"apt-get", "-q", "-y", "--force-yes", "remove", "irssi",
|
318
318
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
319
319
|
:timeout => @timeout
|
320
320
|
)
|
@@ -328,7 +328,7 @@ mpg123 1.12.1-0ubuntu1
|
|
328
328
|
|
329
329
|
it "should run apt-get purge with the package name" do
|
330
330
|
expect(@provider).to receive(:shell_out!).with(
|
331
|
-
"apt-get -q -y purge irssi",
|
331
|
+
"apt-get", "-q", "-y", "purge", "irssi",
|
332
332
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
333
333
|
:timeout => @timeout
|
334
334
|
)
|
@@ -337,7 +337,7 @@ mpg123 1.12.1-0ubuntu1
|
|
337
337
|
|
338
338
|
it "should run apt-get purge with the package name and options if specified" do
|
339
339
|
expect(@provider).to receive(:shell_out!).with(
|
340
|
-
"apt-get -q -y --force-yes purge irssi",
|
340
|
+
"apt-get", "-q", "-y", "--force-yes", "purge", "irssi",
|
341
341
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
342
342
|
:timeout => @timeout
|
343
343
|
)
|
@@ -356,7 +356,7 @@ mpg123 1.12.1-0ubuntu1
|
|
356
356
|
file = "/tmp/irssi-0.8.12-7.seed"
|
357
357
|
|
358
358
|
expect(@provider).to receive(:shell_out!).with(
|
359
|
-
"debconf-set-selections /tmp/irssi-0.8.12-7.seed",
|
359
|
+
"debconf-set-selections", "/tmp/irssi-0.8.12-7.seed",
|
360
360
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
361
361
|
:timeout => @timeout
|
362
362
|
)
|
@@ -366,7 +366,7 @@ mpg123 1.12.1-0ubuntu1
|
|
366
366
|
|
367
367
|
it "should run debconf-set-selections on the preseed file if it has changed" do
|
368
368
|
expect(@provider).to receive(:shell_out!).with(
|
369
|
-
"debconf-set-selections /tmp/irssi-0.8.12-7.seed",
|
369
|
+
"debconf-set-selections", "/tmp/irssi-0.8.12-7.seed",
|
370
370
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
371
371
|
:timeout => @timeout
|
372
372
|
)
|
@@ -387,7 +387,7 @@ mpg123 1.12.1-0ubuntu1
|
|
387
387
|
describe "when reconfiguring a package" do
|
388
388
|
it "should run dpkg-reconfigure package" do
|
389
389
|
expect(@provider).to receive(:shell_out!).with(
|
390
|
-
"dpkg-reconfigure irssi",
|
390
|
+
"dpkg-reconfigure", "irssi",
|
391
391
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
392
392
|
:timeout => @timeout
|
393
393
|
)
|
@@ -398,7 +398,7 @@ mpg123 1.12.1-0ubuntu1
|
|
398
398
|
describe "when locking a package" do
|
399
399
|
it "should run apt-mark hold package" do
|
400
400
|
expect(@provider).to receive(:shell_out!).with(
|
401
|
-
"apt-mark hold irssi",
|
401
|
+
"apt-mark", "hold", "irssi",
|
402
402
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
403
403
|
:timeout => @timeout
|
404
404
|
)
|
@@ -409,7 +409,7 @@ mpg123 1.12.1-0ubuntu1
|
|
409
409
|
describe "when unlocking a package" do
|
410
410
|
it "should run apt-mark unhold package" do
|
411
411
|
expect(@provider).to receive(:shell_out!).with(
|
412
|
-
"apt-mark unhold irssi",
|
412
|
+
"apt-mark", "unhold", "irssi",
|
413
413
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
414
414
|
:timeout => @timeout
|
415
415
|
)
|
@@ -421,7 +421,7 @@ mpg123 1.12.1-0ubuntu1
|
|
421
421
|
it "should install the package without specifying a version" do
|
422
422
|
@provider.package_data["libmysqlclient15-dev"][:virtual] = true
|
423
423
|
expect(@provider).to receive(:shell_out!).with(
|
424
|
-
"apt-get -q -y install libmysqlclient15-dev",
|
424
|
+
"apt-get", "-q", "-y", "install", "libmysqlclient15-dev",
|
425
425
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
426
426
|
:timeout => @timeout
|
427
427
|
)
|
@@ -433,7 +433,7 @@ mpg123 1.12.1-0ubuntu1
|
|
433
433
|
it "should remove the resolved name instead of the virtual package name" do
|
434
434
|
expect(@provider).to receive(:resolve_virtual_package_name).with("libmysqlclient15-dev").and_return("libmysqlclient-dev")
|
435
435
|
expect(@provider).to receive(:shell_out!).with(
|
436
|
-
"apt-get -q -y remove libmysqlclient-dev",
|
436
|
+
"apt-get", "-q", "-y", "remove", "libmysqlclient-dev",
|
437
437
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
438
438
|
:timeout => @timeout
|
439
439
|
)
|
@@ -445,7 +445,7 @@ mpg123 1.12.1-0ubuntu1
|
|
445
445
|
it "should purge the resolved name instead of the virtual package name" do
|
446
446
|
expect(@provider).to receive(:resolve_virtual_package_name).with("libmysqlclient15-dev").and_return("libmysqlclient-dev")
|
447
447
|
expect(@provider).to receive(:shell_out!).with(
|
448
|
-
"apt-get -q -y purge libmysqlclient-dev",
|
448
|
+
"apt-get", "-q", "-y", "purge", "libmysqlclient-dev",
|
449
449
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
450
450
|
:timeout => @timeout
|
451
451
|
)
|
@@ -457,7 +457,7 @@ mpg123 1.12.1-0ubuntu1
|
|
457
457
|
it "can install a virtual package followed by a non-virtual package" do
|
458
458
|
# https://github.com/chef/chef/issues/2914
|
459
459
|
expect(@provider).to receive(:shell_out!).with(
|
460
|
-
"apt-get -q -y install libmysqlclient15-dev irssi=0.8.12-7",
|
460
|
+
"apt-get", "-q", "-y", "install", "libmysqlclient15-dev", "irssi=0.8.12-7",
|
461
461
|
:env => { "DEBIAN_FRONTEND" => "noninteractive" },
|
462
462
|
:timeout => @timeout
|
463
463
|
)
|