diff options
author | NAshwini <ashwini.nehate@msystechnologies.com> | 2020-02-06 12:20:18 +0530 |
---|---|---|
committer | NAshwini <ashwini.nehate@msystechnologies.com> | 2020-03-05 11:19:16 +0530 |
commit | a6d7991ba02f82fc17ecec26feeb965a045d9654 (patch) | |
tree | ad93283530305081561ba04c0573e3cf9aaf5e68 | |
parent | 1ddc0927fe46d844de6ec2072759ce4f212112fc (diff) | |
download | chef-a6d7991ba02f82fc17ecec26feeb965a045d9654.tar.gz |
Replace powershell_out to powershell_exec
Signed-off-by: NAshwini <ashwini.nehate@msystechnologies.com>
-rw-r--r-- | lib/chef/resource/windows_security_policy.rb | 4 | ||||
-rw-r--r-- | spec/functional/resource/windows_security_policy_spec.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_security_policy.rb b/lib/chef/resource/windows_security_policy.rb index 3cd0c503aa..14e25ac943 100644 --- a/lib/chef/resource/windows_security_policy.rb +++ b/lib/chef/resource/windows_security_policy.rb @@ -49,13 +49,13 @@ class Chef property :secvalue, String, required: true, description: "Policy value to be set for policy name." - property :sensitive, [true, false], default: true, + property :sensitive, [TrueClass, FalseClass], default: true, description: "Ensure that sensitive resource data is not logged by Chef Infra Client.", default_description: "true" action :set do security_option = new_resource.secoption - if powershell_out!("(Get-PackageSource -Name PSGallery -WarningAction SilentlyContinue).name").stdout.empty? || powershell_out!("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").stdout.empty? + if powershell_exec("(Get-PackageSource -Name PSGallery).name").result.empty? || powershell_exec("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").result.empty? raise "This resource needs Powershell module cSecurityOptions to be installed. \n Please install it and then re-run the recipe. \n https://www.powershellgallery.com/packages/cSecurityOptions/3.1.3" end diff --git a/spec/functional/resource/windows_security_policy_spec.rb b/spec/functional/resource/windows_security_policy_spec.rb index c09a5d0c5c..62e379962d 100644 --- a/spec/functional/resource/windows_security_policy_spec.rb +++ b/spec/functional/resource/windows_security_policy_spec.rb @@ -21,9 +21,9 @@ require "functional/resource/base" require "chef/mixin/powershell_out" describe Chef::Resource::WindowsSecurityPolicy, :windows_only do - include Chef::Mixin::PowershellOut + include Chef::Mixin::PowershellExec before(:all) { - powershell_out!("Install-Module -Name cSecurityOptions -Force") if powershell_out!("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").stdout.empty? + powershell_exec("Install-Module -Name cSecurityOptions -Force") if powershell_exec("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").result.empty? } let(:secoption) { "MaximumPasswordAge" } |