summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-06-23 08:34:35 -0700
committerJohn McCrae <john.mccrae@progress.com>2022-06-23 08:34:35 -0700
commit201ad1ab88405f3c676712be27cb9d3ad15a4c63 (patch)
treeebe5368ad980cf7f69ccdb542ab53162b663f95e
parentc061eea9995d8ea676dc5fd24fda16e068ed50a3 (diff)
downloadchef-201ad1ab88405f3c676712be27cb9d3ad15a4c63.tar.gz
Refactored tests for older Windows versions
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--spec/integration/client/client_spec.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index a56c640188..3fa2e608e1 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -72,13 +72,18 @@ describe "chef-client" do
def verify_export_password_exists
powershell_exec! <<~EOH
- Try {
- $response = Get-ItemPropertyValue -Path "HKLM:\\Software\\Progress\\Authentication" -Name "PfxPass" -ErrorAction Stop
- if ($response) {return $true}
- }
- Catch {
- return $false
+ Try {
+ if (-not (($PSVersionTable.PSVersion.Major -ge 5) -and ($PSVersionTable.PSVersion.Build -ge 22000)) ) {
+ $response = Get-ItemProperty -Path "HKLM:\\Software\\Progress\\Authentication" -Name "PfxPass" -ErrorAction Stop
+ }
+ else {
+ $response = Get-ItemPropertyValue -Path "HKLM:\\Software\\Progress\\Authentication" -Name "PfxPass" -ErrorAction Stop
+ }
+ if ($response) {return $true}
}
+ Catch {
+ return $false
+ }
EOH
end