summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-06-02 10:01:07 -0700
committerJohn McCrae <john.mccrae@progress.com>2022-06-02 10:01:07 -0700
commit771928e0bea6024b2e5ffc7047169429f8cbb483 (patch)
treee02cb235d771e565ccb8e1f4e7b2b16a30a73313
parent3201e5f2025779c2acd04c4c5e3193b9005e8276 (diff)
downloadchef-771928e0bea6024b2e5ffc7047169429f8cbb483.tar.gz
Adjusting cert creation for older Windows platforms
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--spec/integration/client/client_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 3960123acd..706dbe73c7 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -37,7 +37,14 @@ describe "chef-client" do
def install_certificate_in_store(client_name)
if ChefUtils.windows?
- powershell_exec!("New-SelfSignedCertificate -certstorelocation cert:\\localmachine\\my -Subject #{client_name} -FriendlyName #{client_name} -KeyExportPolicy Exportable")
+ powershell_exec! <<~EOH
+ if ($PSVersionTable.PSVersion -match 3) {
+ New-SelfSignedCertificate -CertStoreLocation Cert:\\LocalMachine\\My -DnsName #{client_name}
+ }
+ else {
+ New-SelfSignedCertificate -certstorelocation cert:\\localmachine\\my -Subject #{client_name} -FriendlyName #{client_name} -KeyExportPolicy Exportable
+ }
+ EOH
end
end