summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2020-02-05 22:02:06 -0800
committerVasu1105 <vasundhara.jagdale@msystechnologies.com>2020-02-23 23:09:55 -0800
commit39bd22505b847ff305ca4a6c58b0c0a64c367e44 (patch)
tree4087e9dc6b4b66ce6cf944bb3b0a917b7003fc2c
parent7a4b9d78051f6ed46b9434c2fa733d4ca27cbf5b (diff)
downloadchef-39bd22505b847ff305ca4a6c58b0c0a64c367e44.tar.gz
Replaced powershell_out with powershell_exec and updated data type for sensitive class
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r--lib/chef/resource/windows_user_privilege.rb6
-rw-r--r--spec/functional/resource/windows_user_privilege_spec.rb8
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/resource/windows_user_privilege.rb b/lib/chef/resource/windows_user_privilege.rb
index c5538c7e19..b1955bd43b 100644
--- a/lib/chef/resource/windows_user_privilege.rb
+++ b/lib/chef/resource/windows_user_privilege.rb
@@ -1,7 +1,7 @@
#
# Author:: Jared Kauppila (<jared@kauppi.la>)
# Author:: Vasundhara Jagdale(<vasundhara.jagdale@chef.io>)
-# Copyright 2008-2019, Chef Software, Inc.
+# Copyright 2008-2020, Chef Software, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -88,7 +88,7 @@ class Chef
},
}
- property :sensitive, [true, false], default: true
+ property :sensitive, [TrueClass, FalseClass], default: true
load_current_value do |new_resource|
unless new_resource.principal.nil?
@@ -111,7 +111,7 @@ class Chef
raise Chef::Exceptions::ValidationFailed, "Users are required property with set action."
end
- if powershell_out!("Get-PackageSource -Name PSGallery").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_user_privilege_spec.rb b/spec/functional/resource/windows_user_privilege_spec.rb
index 4f67032ff0..cf1320e12a 100644
--- a/spec/functional/resource/windows_user_privilege_spec.rb
+++ b/spec/functional/resource/windows_user_privilege_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@chef.io>)
-# Copyright 2008-2019, Chef Software, Inc.
+# Copyright 2008-2020, Chef Software, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ require_relative "../../spec_helper"
require_relative "../../functional/resource/base"
describe Chef::Resource::WindowsUserPrivilege, :windows_only do
- include Chef::Mixin::PowershellOut
+ include Chef::Mixin::PowershellExec
let(:principal) { nil }
let(:privilege) { nil }
@@ -65,7 +65,7 @@ describe Chef::Resource::WindowsUserPrivilege, :windows_only do
describe "#set privilege" do
before(:all) {
- powershell_out!("Uninstall-Module -Name cSecurityOptions") unless powershell_out!("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").stdout.empty?
+ powershell_exec("Uninstall-Module -Name cSecurityOptions") unless powershell_exec("(Get-Package -Name cSecurityOptions -WarningAction SilentlyContinue).name").result.empty?
}
let(:principal) { "user_privilege" }
@@ -80,7 +80,7 @@ describe Chef::Resource::WindowsUserPrivilege, :windows_only do
describe "#set privilege" do
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?
}
after { remove_user_privilege("Administrator", subject.privilege) }