chef 15.10.12 → 15.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -10
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +3 -3
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/application/apply.rb +2 -2
- data/lib/chef/application/exit_code.rb +2 -2
- data/lib/chef/chef_fs/chef_fs_data_store.rb +3 -3
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +3 -3
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/cookbook_version.rb +4 -4
- data/lib/chef/data_bag.rb +2 -2
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/deprecated.rb +13 -1
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +3 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +2 -2
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +7 -7
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife.rb +26 -20
- data/lib/chef/knife/bootstrap.rb +30 -31
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +12 -8
- data/lib/chef/knife/bootstrap/client_builder.rb +23 -19
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
- data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +3 -1
- data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_show.rb +1 -1
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/core/windows_bootstrap_context.rb +18 -3
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +21 -2
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mixin/create_path.rb +8 -8
- data/lib/chef/mixin/openssl_helper.rb +26 -3
- data/lib/chef/mixin/template.rb +1 -0
- data/lib/chef/node/mixin/deep_merge_cache.rb +7 -7
- data/lib/chef/node_map.rb +5 -2
- data/lib/chef/provider/mount/solaris.rb +0 -1
- data/lib/chef/provider/package/cab.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +4 -3
- data/lib/chef/provider/package/msu.rb +1 -0
- data/lib/chef/provider/package/powershell.rb +5 -1
- data/lib/chef/provider/package/snap.rb +96 -27
- data/lib/chef/provider/package/zypper.rb +0 -1
- data/lib/chef/provider/service/arch.rb +2 -2
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +1 -1
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/simple.rb +3 -3
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/windows_task.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +1 -1
- data/lib/chef/provider/zypper_repository.rb +31 -11
- data/lib/chef/resource.rb +2 -0
- data/lib/chef/resource/archive_file.rb +28 -8
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/cron_access.rb +13 -5
- data/lib/chef/resource/cron_d.rb +1 -1
- data/lib/chef/resource/hostname.rb +19 -18
- data/lib/chef/resource/launchd.rb +4 -4
- data/lib/chef/resource/lwrp_base.rb +7 -0
- data/lib/chef/resource/macos_userdefaults.rb +3 -3
- data/lib/chef/resource/msu_package.rb +5 -0
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sudo.rb +2 -2
- data/lib/chef/resource/windows_feature_powershell.rb +6 -2
- data/lib/chef/resource/windows_firewall_rule.rb +8 -4
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/resource/windows_share.rb +4 -4
- data/lib/chef/resource/windows_task.rb +13 -13
- data/lib/chef/resource_inspector.rb +4 -3
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/shell_session.rb +2 -0
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +3 -3
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/win32/api/command_line_helper.rb +89 -0
- data/lib/chef/win32/api/file.rb +18 -18
- data/lib/chef/win32/file.rb +3 -3
- data/lib/chef/win32/process.rb +2 -2
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/resource/aix_service_spec.rb +0 -1
- data/spec/functional/resource/aixinit_service_spec.rb +7 -8
- data/spec/functional/resource/apt_package_spec.rb +0 -1
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/chocolatey_package_spec.rb +29 -0
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/cron_spec.rb +0 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/insserv_spec.rb +4 -5
- data/spec/functional/resource/link_spec.rb +17 -17
- data/spec/functional/resource/msu_package_spec.rb +5 -2
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +2 -2
- data/spec/functional/resource/user/mac_user_spec.rb +2 -2
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/resource/windows_task_spec.rb +8 -8
- data/spec/functional/run_lock_spec.rb +2 -1
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/recipes/accumulator_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
- data/spec/integration/recipes/lwrp_spec.rb +1 -1
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/notifying_block_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
- data/spec/integration/recipes/resource_load_spec.rb +1 -0
- data/spec/integration/recipes/unified_mode_spec.rb +1 -1
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +26 -19
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/platform_helpers.rb +12 -42
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +3 -3
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/knife_support.rb +2 -5
- data/spec/unit/application_spec.rb +7 -0
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
- data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
- data/spec/unit/data_bag_spec.rb +1 -1
- data/spec/unit/data_collector_spec.rb +1 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
- data/spec/unit/file_access_control_spec.rb +1 -1
- data/spec/unit/json_compat_spec.rb +1 -1
- data/spec/unit/knife/bootstrap_spec.rb +26 -29
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +6 -0
- data/spec/unit/knife/role_env_run_list_add_spec.rb +6 -6
- data/spec/unit/knife/role_env_run_list_clear_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_remove_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_replace_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_set_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_add_spec.rb +6 -6
- data/spec/unit/knife/role_run_list_clear_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_remove_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_replace_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_set_spec.rb +4 -4
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mixin/securable_spec.rb +0 -1
- data/spec/unit/mixin/user_context_spec.rb +1 -9
- data/spec/unit/property_spec.rb +6 -6
- data/spec/unit/provider/apt_repository_spec.rb +2 -2
- data/spec/unit/provider/git_spec.rb +3 -3
- data/spec/unit/provider/osx_profile_spec.rb +2 -2
- data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
- data/spec/unit/provider/package/msu_spec.rb +3 -3
- data/spec/unit/provider/package/powershell_spec.rb +95 -86
- data/spec/unit/provider/package/rubygems_spec.rb +5 -10
- data/spec/unit/provider/package/snap_spec.rb +1 -1
- data/spec/unit/provider/package/windows_spec.rb +30 -53
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +8 -8
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider/service/windows_spec.rb +2 -6
- data/spec/unit/provider/systemd_unit_spec.rb +28 -24
- data/spec/unit/provider/zypper_repository_spec.rb +75 -25
- data/spec/unit/provider_resolver_spec.rb +9 -9
- data/spec/unit/provider_spec.rb +1 -0
- data/spec/unit/resource/archive_file_spec.rb +11 -2
- data/spec/unit/resource/msu_package_spec.rb +4 -0
- data/spec/unit/resource/windows_dns_record_spec.rb +3 -3
- data/spec/unit/resource/windows_dns_zone_spec.rb +2 -2
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/resource/windows_package_spec.rb +1 -0
- data/spec/unit/resource/windows_task_spec.rb +1 -1
- data/spec/unit/resource/windows_uac_spec.rb +2 -2
- data/spec/unit/resource/yum_repository_spec.rb +21 -21
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +1 -1
- data/spec/unit/role_spec.rb +11 -11
- data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
- data/spec/unit/run_context_spec.rb +1 -1
- data/spec/unit/run_lock_spec.rb +1 -1
- data/spec/unit/scan_access_control_spec.rb +1 -1
- data/spec/unit/util/threaded_job_queue_spec.rb +9 -0
- data/spec/unit/win32/security_spec.rb +4 -3
- data/tasks/rspec.rb +5 -13
- metadata +24 -16
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListReplace do
|
|
43
43
|
|
44
44
|
describe "run" do
|
45
45
|
|
46
|
-
# it "should display all the things" do
|
47
|
-
# @knife.run
|
48
|
-
# @role.to_json.should == 'show all the things'
|
49
|
-
# end
|
46
|
+
# it "should display all the things" do
|
47
|
+
# @knife.run
|
48
|
+
# @role.to_json.should == 'show all the things'
|
49
|
+
# end
|
50
50
|
|
51
51
|
it "should load the node" do
|
52
52
|
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
|
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListSet do
|
|
43
43
|
|
44
44
|
describe "run" do
|
45
45
|
|
46
|
-
# it "should display all the things" do
|
47
|
-
# @knife.run
|
48
|
-
# @role.to_json.should == 'show all the things'
|
49
|
-
# end
|
46
|
+
# it "should display all the things" do
|
47
|
+
# @knife.run
|
48
|
+
# @role.to_json.should == 'show all the things'
|
49
|
+
# end
|
50
50
|
|
51
51
|
it "should load the node" do
|
52
52
|
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
|
data/spec/unit/knife/ssh_spec.rb
CHANGED
@@ -279,10 +279,10 @@ describe Chef::Knife::Ssh do
|
|
279
279
|
end
|
280
280
|
|
281
281
|
describe "#ssh_command" do
|
282
|
-
let(:execution_channel) { double(:execution_channel, on_data: nil) }
|
282
|
+
let(:execution_channel) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
|
283
283
|
let(:session_channel) { double(:session_channel, request_pty: nil) }
|
284
284
|
|
285
|
-
let(:execution_channel2) { double(:execution_channel, on_data: nil) }
|
285
|
+
let(:execution_channel2) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
|
286
286
|
let(:session_channel2) { double(:session_channel, request_pty: nil) }
|
287
287
|
|
288
288
|
let(:session) { double(:session, loop: nil) }
|
@@ -108,7 +108,7 @@ describe Chef::Knife::SupermarketShare do
|
|
108
108
|
expect { @knife.run }.to raise_error(SystemExit)
|
109
109
|
end
|
110
110
|
|
111
|
-
if File.
|
111
|
+
if File.exist?("/usr/bin/gnutar") || File.exist?("/bin/gnutar")
|
112
112
|
it "should use gnutar to make a tarball of the cookbook" do
|
113
113
|
expect(@knife).to receive(:shell_out!) do |args|
|
114
114
|
expect(args.to_s).to match(/gnutar -czf/)
|
data/spec/unit/lwrp_spec.rb
CHANGED
@@ -140,7 +140,7 @@ describe "LWRP" do
|
|
140
140
|
before do
|
141
141
|
@tmpdir = Dir.mktmpdir("lwrp_test")
|
142
142
|
@lwrp_path = File.join(@tmpdir, "foo.rb")
|
143
|
-
content = IO.read(File.expand_path("
|
143
|
+
content = IO.read(File.expand_path("../data/lwrp/resources/foo.rb", __dir__))
|
144
144
|
IO.write(@lwrp_path, content)
|
145
145
|
Chef::Resource::LWRPBase.build_from_file("lwrp", @lwrp_path, nil)
|
146
146
|
@original_resource = Chef::ResourceResolver.resolve(:lwrp_foo)
|
@@ -152,7 +152,7 @@ describe "LWRP" do
|
|
152
152
|
|
153
153
|
context "And the LWRP is asked to load again, this time with different code" do
|
154
154
|
before do
|
155
|
-
content = IO.read(File.expand_path("
|
155
|
+
content = IO.read(File.expand_path("../data/lwrp_override/resources/foo.rb", __dir__))
|
156
156
|
IO.write(@lwrp_path, content)
|
157
157
|
Chef::Resource::LWRPBase.build_from_file("lwrp", @lwrp_path, nil)
|
158
158
|
end
|
@@ -390,11 +390,11 @@ describe "LWRP" do
|
|
390
390
|
end
|
391
391
|
|
392
392
|
before(:each) do
|
393
|
-
Dir[File.expand_path(File.expand_path("
|
393
|
+
Dir[File.expand_path(File.expand_path("../data/lwrp/resources/*", __dir__))].each do |file|
|
394
394
|
Chef::Resource::LWRPBase.build_from_file(lwrp_cookbook_name, file, run_context)
|
395
395
|
end
|
396
396
|
|
397
|
-
Dir[File.expand_path(File.expand_path("
|
397
|
+
Dir[File.expand_path(File.expand_path("../data/lwrp/providers/*", __dir__))].each do |file|
|
398
398
|
Chef::Provider::LWRPBase.build_from_file(lwrp_cookbook_name, file, run_context)
|
399
399
|
end
|
400
400
|
end
|
@@ -77,17 +77,9 @@ describe "a class that mixes in user_context" do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
context "when the block raises an exception" do
|
80
|
-
class UserContextTestException < RuntimeError
|
81
|
-
end
|
82
|
-
let(:block_parameter) { Proc.new { raise UserContextTextException } }
|
83
|
-
|
84
|
-
it "raises the exception raised by the block" do
|
85
|
-
expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error(UserContextTestException)
|
86
|
-
end
|
87
|
-
|
88
80
|
it "closes the logon session so resources are not leaked" do
|
89
81
|
expect(logon_session).to receive(:close)
|
90
|
-
expect { instance_with_user_context.with_context("kamilah", nil, "chef4life"
|
82
|
+
expect { instance_with_user_context.with_context("kamilah", nil, "chef4life") { 1 / 0 } }.to raise_error(ZeroDivisionError)
|
91
83
|
end
|
92
84
|
end
|
93
85
|
end
|
data/spec/unit/property_spec.rb
CHANGED
@@ -111,17 +111,17 @@ describe "Chef::Resource.property" do
|
|
111
111
|
|
112
112
|
with_property ":Straße" do
|
113
113
|
it "properties with UTF-8 in their name work" do
|
114
|
-
expect(resource.Straße).to eql(nil)
|
115
|
-
expect(resource.Straße "foo").to eql("foo")
|
116
|
-
expect(resource.Straße).to eql("foo")
|
117
|
-
expect(resource.Straße = "bar").to eql("bar")
|
118
|
-
expect(resource.Straße).to eql("bar")
|
114
|
+
expect(resource.Straße).to eql(nil) # rubocop: disable Naming/AsciiIdentifiers
|
115
|
+
expect(resource.Straße "foo").to eql("foo") # rubocop: disable Naming/AsciiIdentifiers
|
116
|
+
expect(resource.Straße).to eql("foo") # rubocop: disable Naming/AsciiIdentifiers
|
117
|
+
expect(resource.Straße = "bar").to eql("bar") # rubocop: disable Naming/AsciiIdentifiers
|
118
|
+
expect(resource.Straße).to eql("bar") # rubocop: disable Naming/AsciiIdentifiers
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
context "deprecated properties" do
|
123
123
|
it "does not create a deprecation warning on definition" do
|
124
|
-
expect { resource_class.class_eval { property :x, String, deprecated: 10 } }.not_to raise_error
|
124
|
+
expect { resource_class.class_eval { property :x, String, deprecated: 10 } }.not_to raise_error
|
125
125
|
end
|
126
126
|
|
127
127
|
with_property ":x, deprecated: 'a deprecated property'" do
|
@@ -38,7 +38,7 @@ EOF
|
|
38
38
|
|
39
39
|
# Output of the command:
|
40
40
|
# => gpg --with-fingerprint --with-colons [FILE]
|
41
|
-
|
41
|
+
APT_GPG_FINGER = <<~EOF.freeze
|
42
42
|
pub:-:1024:17:327574EE02A818DD:2009-04-22:::-:Cloudera Apt Repository:
|
43
43
|
fpr:::::::::F36A89E33CC1BD0F71079007327574EE02A818DD:
|
44
44
|
sub:-:2048:16:84080586D1CA74A1:2009-04-22::::
|
@@ -63,7 +63,7 @@ describe Chef::Provider::AptRepository do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
let(:gpg_finger) do
|
66
|
-
double("shell_out", stdout:
|
66
|
+
double("shell_out", stdout: APT_GPG_FINGER, exitstatus: 0, error?: false)
|
67
67
|
end
|
68
68
|
|
69
69
|
let(:gpg_shell_out_success) do
|
@@ -638,7 +638,7 @@ describe Chef::Provider::Git do
|
|
638
638
|
expect(@provider).to receive(:enable_submodules)
|
639
639
|
expect(@provider).to receive(:add_remotes)
|
640
640
|
@provider.run_action(:checkout)
|
641
|
-
|
641
|
+
# @resource.should be_updated
|
642
642
|
end
|
643
643
|
|
644
644
|
it "should not checkout if the destination exists or is a non empty directory" do
|
@@ -676,7 +676,7 @@ describe Chef::Provider::Git do
|
|
676
676
|
expect(@provider).to receive(:enable_submodules)
|
677
677
|
expect(@provider).to receive(:add_remotes)
|
678
678
|
@provider.run_action(:sync)
|
679
|
-
|
679
|
+
# @resource.should be_updated
|
680
680
|
end
|
681
681
|
|
682
682
|
it "does not fetch any updates if the remote revision matches the current revision" do
|
@@ -696,7 +696,7 @@ describe Chef::Provider::Git do
|
|
696
696
|
expect(@provider).to receive(:action_checkout)
|
697
697
|
expect(@provider).not_to receive(:shell_out!)
|
698
698
|
@provider.run_action(:sync)
|
699
|
-
|
699
|
+
# @resource.should be_updated
|
700
700
|
end
|
701
701
|
|
702
702
|
it "clones the repo instead of fetching updates if the deploy directory is empty" do
|
@@ -61,8 +61,8 @@ describe Chef::Provider::OsxProfile do
|
|
61
61
|
"ProfileVersion" => 1 }],
|
62
62
|
}
|
63
63
|
end
|
64
|
-
|
65
|
-
|
64
|
+
# If anything is changed within this profile, be sure to update the
|
65
|
+
# ProfileUUID in all_profiles to match the new config specific UUID
|
66
66
|
let(:test_profile) do
|
67
67
|
{
|
68
68
|
"PayloadIdentifier" => "com.testprofile.screensaver",
|
@@ -22,7 +22,7 @@ require "spec_helper"
|
|
22
22
|
describe Chef::Provider::Package::Dnf::PythonHelper do
|
23
23
|
let(:helper) { Chef::Provider::Package::Dnf::PythonHelper.instance }
|
24
24
|
|
25
|
-
it "propagates stacktraces on stderr from the forked subprocess" do
|
25
|
+
it "propagates stacktraces on stderr from the forked subprocess", :rhel do
|
26
26
|
allow(helper).to receive(:dnf_command).and_return("ruby -e 'raise \"your hands in the air\"'")
|
27
27
|
expect { helper.query(:whatprovides, "tcpdump") }.to raise_error(/your hands in the air/)
|
28
28
|
end
|
@@ -261,9 +261,9 @@ describe Chef::Provider::Package::Msu, :windows_only do
|
|
261
261
|
expect(cab_files).to eql(["msu_dir/IE10-Windows6.1-KB2859903-x86.CAB"])
|
262
262
|
end
|
263
263
|
|
264
|
-
# We couldn't find any msu file with multiple cab files in it.
|
265
|
-
# So we are not 100% sure about the structure of XML file in this case
|
266
|
-
# The specs below cover 2 possible XML formats
|
264
|
+
# We couldn't find any msu file with multiple cab files in it.
|
265
|
+
# So we are not 100% sure about the structure of XML file in this case
|
266
|
+
# The specs below cover 2 possible XML formats
|
267
267
|
context "handles different xml formats for multiple cab files in the msu package" do
|
268
268
|
it "parses xml file with multiple <package> tags" do
|
269
269
|
xml_file = File.join(CHEF_SPEC_DATA, "sample_msu2.xml")
|
@@ -93,19 +93,19 @@ describe Chef::Provider::Package::Powershell do
|
|
93
93
|
double("powershell_out", stdout: "5")
|
94
94
|
end
|
95
95
|
|
96
|
-
let(:generated_command) { "( Get-Package posh-git -Force -ForceBootstrap ).Version" }
|
97
|
-
let(:generated_get_cmdlet) { "( Get-Package xNetworking -Force -ForceBootstrap ).Version" }
|
98
|
-
let(:generated_get_cmdlet_with_version) { "( Get-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
|
99
|
-
let(:generated_find_cmdlet) { "( Find-Package xNetworking -Force -ForceBootstrap ).Version" }
|
100
|
-
let(:generated_find_cmdlet_with_version) { "( Find-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
|
101
|
-
let(:generated_find_cmdlet_with_source) { "( Find-Package xNetworking -Force -ForceBootstrap -Source MyGallery ).Version" }
|
102
|
-
let(:generated_find_cmdlet_with_source_and_version) { "( Find-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
|
103
|
-
let(:generated_install_cmdlet) { "( Install-Package xNetworking -Force -ForceBootstrap ).Version" }
|
104
|
-
let(:generated_install_cmdlet_with_version) { "( Install-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
|
105
|
-
let(:generated_install_cmdlet_with_source) { "( Install-Package xNetworking -Force -ForceBootstrap -Source MyGallery ).Version" }
|
106
|
-
let(:generated_install_cmdlet_with_source_and_version) { "( Install-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
|
107
|
-
let(:generated_uninstall_cmdlet) { "( Uninstall-Package xNetworking -Force -ForceBootstrap ).Version" }
|
108
|
-
let(:generated_uninstall_cmdlet_with_version) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -RequiredVersion 1.0.0.0 ).Version" }
|
96
|
+
let(:generated_command) { "( Get-Package posh-git -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
97
|
+
let(:generated_get_cmdlet) { "( Get-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
98
|
+
let(:generated_get_cmdlet_with_version) { "( Get-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
99
|
+
let(:generated_find_cmdlet) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
100
|
+
let(:generated_find_cmdlet_with_version) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
101
|
+
let(:generated_find_cmdlet_with_source) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version" }
|
102
|
+
let(:generated_find_cmdlet_with_source_and_version) { "( Find-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
|
103
|
+
let(:generated_install_cmdlet) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
104
|
+
let(:generated_install_cmdlet_with_version) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
105
|
+
let(:generated_install_cmdlet_with_source) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version" }
|
106
|
+
let(:generated_install_cmdlet_with_source_and_version) { "( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
|
107
|
+
let(:generated_uninstall_cmdlet) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
108
|
+
let(:generated_uninstall_cmdlet_with_version) { "( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
109
109
|
|
110
110
|
describe "#initialize" do
|
111
111
|
it "should return the correct class" do
|
@@ -116,14 +116,14 @@ describe Chef::Provider::Package::Powershell do
|
|
116
116
|
describe "#candidate_version" do
|
117
117
|
|
118
118
|
it "should set the candidate_version to the latest version when not pinning" do
|
119
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
119
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
120
120
|
new_resource.package_name(["xNetworking"])
|
121
121
|
new_resource.version(nil)
|
122
122
|
expect(provider.candidate_version).to eql(["2.12.0.0"])
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should use the candidate_version from the correct source" do
|
126
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
126
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
127
127
|
new_resource.package_name(["xNetworking"])
|
128
128
|
new_resource.version(nil)
|
129
129
|
new_resource.source("MyGallery")
|
@@ -131,60 +131,60 @@ describe Chef::Provider::Package::Powershell do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should set the candidate_version to the latest version when not pinning and package name is space seperated" do
|
134
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
|
134
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
|
135
135
|
new_resource.package_name(["7-Zip 16.02 (x64)"])
|
136
136
|
new_resource.version(nil)
|
137
137
|
expect(provider.candidate_version).to eql(["16.02"])
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should set the candidate_version to pinned version if available" do
|
141
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.0.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
|
141
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.0.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
|
142
142
|
new_resource.package_name(["xCertificate"])
|
143
143
|
new_resource.version(["2.0.0.0"])
|
144
144
|
expect(provider.candidate_version).to eql(["2.0.0.0"])
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should set the candidate_version to nil if there is no candidate" do
|
148
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
148
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
149
149
|
new_resource.package_name(["xCertificate"])
|
150
150
|
expect(provider.candidate_version).to eql([nil])
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should set the candidate_version correctly when there are two packages to install" do
|
154
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
155
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
154
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
155
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
156
156
|
new_resource.package_name(%w{xCertificate xNetworking})
|
157
157
|
new_resource.version(nil)
|
158
158
|
expect(provider.candidate_version).to eql(["2.1.0.0", "2.12.0.0"])
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should set the candidate_version correctly when only the first is installable" do
|
162
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
163
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
162
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
163
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
164
164
|
new_resource.package_name(%w{xCertificate xNetworking})
|
165
165
|
new_resource.version(nil)
|
166
166
|
expect(provider.candidate_version).to eql(["2.1.0.0", nil])
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should set the candidate_version correctly when only the last is installable" do
|
170
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
171
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
170
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
171
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
172
172
|
new_resource.package_name(%w{xCertificate xNetworking})
|
173
173
|
new_resource.version(nil)
|
174
174
|
expect(provider.candidate_version).to eql([nil, "2.12.0.0"])
|
175
175
|
end
|
176
176
|
|
177
177
|
it "should set the candidate_version correctly when neither are is installable and version is passed as nil array" do
|
178
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
179
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
178
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
179
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
180
180
|
new_resource.package_name(%w{xNetworking xCertificate})
|
181
181
|
new_resource.version([nil, nil])
|
182
182
|
expect(provider.candidate_version).to eql([nil, nil])
|
183
183
|
end
|
184
184
|
|
185
185
|
it "should set the candidate_version correctly when neither are is installable and version is not passed" do
|
186
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
187
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
186
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
187
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
188
188
|
new_resource.package_name(%w{xNetworking xCertificate})
|
189
189
|
new_resource.version(nil)
|
190
190
|
expect(provider.candidate_version).to eql([nil, nil])
|
@@ -283,10 +283,11 @@ describe Chef::Provider::Package::Powershell do
|
|
283
283
|
provider.load_current_resource
|
284
284
|
new_resource.package_name(["xCertificate"])
|
285
285
|
new_resource.version(nil)
|
286
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
287
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
286
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
287
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
288
288
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
289
|
-
|
289
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
290
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
290
291
|
provider.run_action(:install)
|
291
292
|
expect(new_resource).to be_updated_by_last_action
|
292
293
|
end
|
@@ -296,10 +297,11 @@ describe Chef::Provider::Package::Powershell do
|
|
296
297
|
new_resource.package_name(["xCertificate"])
|
297
298
|
new_resource.version(nil)
|
298
299
|
new_resource.source("MyGallery")
|
299
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
300
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
300
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
301
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
301
302
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
302
|
-
|
303
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
304
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
|
303
305
|
provider.run_action(:install)
|
304
306
|
expect(new_resource).to be_updated_by_last_action
|
305
307
|
end
|
@@ -309,10 +311,11 @@ describe Chef::Provider::Package::Powershell do
|
|
309
311
|
new_resource.package_name(["xCertificate"])
|
310
312
|
new_resource.version(nil)
|
311
313
|
new_resource.skip_publisher_check(true)
|
312
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
313
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -SkipPublisherCheck ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
314
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
315
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -SkipPublisherCheck ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
314
316
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
315
|
-
|
317
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
318
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -SkipPublisherCheck ).Version", { timeout: new_resource.timeout })
|
316
319
|
provider.run_action(:install)
|
317
320
|
expect(new_resource).to be_updated_by_last_action
|
318
321
|
end
|
@@ -321,10 +324,11 @@ describe Chef::Provider::Package::Powershell do
|
|
321
324
|
provider.load_current_resource
|
322
325
|
new_resource.package_name(["7-Zip 16.02 (x64)"])
|
323
326
|
new_resource.version(nil)
|
324
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
|
325
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_not_installed)
|
327
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
|
328
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_not_installed)
|
326
329
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
327
|
-
|
330
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
331
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 16.02 ).Version", { timeout: new_resource.timeout })
|
328
332
|
provider.run_action(:install)
|
329
333
|
expect(new_resource).to be_updated_by_last_action
|
330
334
|
end
|
@@ -336,10 +340,11 @@ describe Chef::Provider::Package::Powershell do
|
|
336
340
|
provider.load_current_resource
|
337
341
|
new_resource.package_name(["xCertificate"])
|
338
342
|
new_resource.version(nil)
|
339
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
340
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
343
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
344
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
341
345
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
342
|
-
|
346
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
347
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
343
348
|
provider.run_action(:install)
|
344
349
|
expect(new_resource).to be_updated_by_last_action
|
345
350
|
end
|
@@ -348,8 +353,8 @@ describe Chef::Provider::Package::Powershell do
|
|
348
353
|
it "should not install packages that are up-to-date" do
|
349
354
|
new_resource.package_name(["xCertificate"])
|
350
355
|
new_resource.version(nil)
|
351
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
352
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
356
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
357
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
353
358
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
354
359
|
provider.load_current_resource
|
355
360
|
expect(provider).not_to receive(:install_package)
|
@@ -360,8 +365,8 @@ describe Chef::Provider::Package::Powershell do
|
|
360
365
|
it "should not install packages that are up-to-date" do
|
361
366
|
new_resource.package_name(["xNetworking"])
|
362
367
|
new_resource.version(["2.11.0.0"])
|
363
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
364
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
|
368
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
369
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
|
365
370
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
366
371
|
provider.load_current_resource
|
367
372
|
expect(provider).not_to receive(:install_package)
|
@@ -374,13 +379,14 @@ describe Chef::Provider::Package::Powershell do
|
|
374
379
|
# new_version.resource[0]
|
375
380
|
new_resource.package_name(%w{xCertificate xNetworking})
|
376
381
|
new_resource.version([nil, "2.11.0.0"])
|
377
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
378
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
379
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
|
380
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
382
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
383
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
384
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
|
385
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
381
386
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
382
|
-
|
383
|
-
expect(provider).to receive(:powershell_out).with("( Install-Package '
|
387
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
388
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
389
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout })
|
384
390
|
provider.load_current_resource
|
385
391
|
provider.run_action(:install)
|
386
392
|
expect(new_resource).to be_updated_by_last_action
|
@@ -389,13 +395,14 @@ describe Chef::Provider::Package::Powershell do
|
|
389
395
|
it "should split up commands when given two packages, one with a version pin" do
|
390
396
|
new_resource.package_name(%w{xCertificate xNetworking})
|
391
397
|
new_resource.version(["2.1.0.0", nil])
|
392
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
393
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
394
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
395
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
398
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
399
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
400
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
401
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
396
402
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
397
|
-
|
398
|
-
expect(provider).to receive(:powershell_out).with("( Install-Package '
|
403
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
404
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
405
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
|
399
406
|
|
400
407
|
provider.load_current_resource
|
401
408
|
provider.run_action(:install)
|
@@ -405,13 +412,14 @@ describe Chef::Provider::Package::Powershell do
|
|
405
412
|
it "should do multipackage installs when given two packages without constraints" do
|
406
413
|
new_resource.package_name(%w{xCertificate xNetworking})
|
407
414
|
new_resource.version(nil)
|
408
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
409
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
410
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
411
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
415
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
416
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
417
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
418
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
412
419
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
413
|
-
|
414
|
-
expect(provider).to receive(:powershell_out).with("( Install-Package '
|
420
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
421
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
422
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
|
415
423
|
provider.load_current_resource
|
416
424
|
provider.run_action(:install)
|
417
425
|
expect(new_resource).to be_updated_by_last_action
|
@@ -421,13 +429,14 @@ describe Chef::Provider::Package::Powershell do
|
|
421
429
|
new_resource.package_name(%w{xCertificate xNetworking})
|
422
430
|
new_resource.version(nil)
|
423
431
|
new_resource.source("MyGallery")
|
424
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
425
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
426
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
427
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
432
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
433
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
434
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
435
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
428
436
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
429
|
-
|
430
|
-
expect(provider).to receive(:powershell_out).with("( Install-Package '
|
437
|
+
allow(provider).to receive(:powershell_out).with("[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12")
|
438
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
|
439
|
+
expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.12.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
|
431
440
|
provider.load_current_resource
|
432
441
|
provider.run_action(:install)
|
433
442
|
expect(new_resource).to be_updated_by_last_action
|
@@ -439,8 +448,8 @@ describe Chef::Provider::Package::Powershell do
|
|
439
448
|
provider.load_current_resource
|
440
449
|
new_resource.package_name(["xCertificate"])
|
441
450
|
new_resource.version(["2.1.0.0"])
|
442
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
443
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
451
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
452
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
444
453
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
445
454
|
expect(provider).not_to receive(:remove_package)
|
446
455
|
provider.run_action(:remove)
|
@@ -451,11 +460,11 @@ describe Chef::Provider::Package::Powershell do
|
|
451
460
|
new_resource.package_name(["xCertificate"])
|
452
461
|
new_resource.version(["2.1.0.0"])
|
453
462
|
new_resource.source("MyGallery")
|
454
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
455
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
463
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
464
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
456
465
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
457
466
|
provider.load_current_resource
|
458
|
-
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
467
|
+
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
459
468
|
provider.run_action(:remove)
|
460
469
|
expect(new_resource).to be_updated_by_last_action
|
461
470
|
end
|
@@ -463,10 +472,10 @@ describe Chef::Provider::Package::Powershell do
|
|
463
472
|
it "does nothing when all the packages are already removed" do
|
464
473
|
new_resource.package_name(%w{xCertificate xNetworking})
|
465
474
|
new_resource.version(nil)
|
466
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
467
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
468
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
469
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
475
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
476
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
477
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
|
478
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
|
470
479
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
471
480
|
provider.load_current_resource
|
472
481
|
expect(provider).not_to receive(:remove_package)
|
@@ -477,11 +486,11 @@ describe Chef::Provider::Package::Powershell do
|
|
477
486
|
it "removes a package when version is specified" do
|
478
487
|
new_resource.package_name(["xCertificate"])
|
479
488
|
new_resource.version(["2.1.0.0"])
|
480
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
481
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
489
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
490
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
482
491
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
483
492
|
provider.load_current_resource
|
484
|
-
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
493
|
+
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
|
485
494
|
provider.run_action(:remove)
|
486
495
|
expect(new_resource).to be_updated_by_last_action
|
487
496
|
end
|
@@ -489,11 +498,11 @@ describe Chef::Provider::Package::Powershell do
|
|
489
498
|
it "removes a package when version is not specified" do
|
490
499
|
new_resource.package_name(["xCertificate"])
|
491
500
|
new_resource.version(nil)
|
492
|
-
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
493
|
-
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
501
|
+
allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
502
|
+
allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
494
503
|
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
495
504
|
provider.load_current_resource
|
496
|
-
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
505
|
+
expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
497
506
|
provider.run_action(:remove)
|
498
507
|
expect(new_resource).to be_updated_by_last_action
|
499
508
|
end
|