summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc A. Paradise <marcparadise@users.noreply.github.com>2022-06-07 19:43:14 +0000
committerGitHub <noreply@github.com>2022-06-07 19:43:14 +0000
commit784b1bd7da5bbc688b3f397ad0f1fe2a296eb9ea (patch)
tree81a204b71ec4659f956bed4baa19442fd64bd6c3
parent5b0270af44cbf186d340e2b9e331175f20a417c4 (diff)
parent771928e0bea6024b2e5ffc7047169429f8cbb483 (diff)
downloadchef-784b1bd7da5bbc688b3f397ad0f1fe2a296eb9ea.tar.gz
Merge pull request #12965 from chef/jfm/server2012_cert_errors
Adjusting cert creation for older Windows platforms. Test failures unrelated to this change.
-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