Skip to content

Commit 142fd1d

Browse files
authored
Fix case where cluster has a cert, but it is not available. (#5640)
1 parent f3094cd commit 142fd1d

File tree

7 files changed

+17
-9
lines changed

7 files changed

+17
-9
lines changed

Tasks/Common/ServiceFabricHelpers/Get-ServiceFabricEncryptedText.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function Get-ServiceFabricEncryptedText
1818
if (-not $cert)
1919
{
2020
Write-Warning (Get-VstsLocString -Key ServerCertificateNotFoundForTextEncrypt -ArgumentList $serverCertThumbprint)
21-
return $Text
21+
return $null
2222
}
2323

2424
# Encrypt the text using the cluster connection's certificate.

Tasks/ServiceFabricComposeDeploy/ServiceFabricComposeDeploy.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ try {
8585
if (-not $isEncrypted -and $clusterConnectionParameters["ServerCertThumbprint"])
8686
{
8787
Write-Host (Get-VstsLocString -Key EncryptingPassword)
88-
$password = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $clusterConnectionParameters
89-
$isEncrypted = $true
88+
$encryptedPassword = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $clusterConnectionParameters
89+
if ($encryptedPassword)
90+
{
91+
$password = $encryptedPassword
92+
$isEncrypted = $true
93+
}
9094
}
9195

9296
if ($usePreviewApi)

Tasks/ServiceFabricComposeDeploy/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 6
19+
"Patch": 7
2020
},
2121
"demands": [
2222
"Cmd"

Tasks/ServiceFabricComposeDeploy/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 6
19+
"Patch": 7
2020
},
2121
"demands": [
2222
"Cmd"

Tasks/ServiceFabricDeploy/Update-DockerSettings.psm1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ function Update-DockerSettings
4545

4646
if (-not $isPasswordEncrypted -and $ClusterConnectionParameters["ServerCertThumbprint"])
4747
{
48-
$password = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $ClusterConnectionParameters
49-
$isPasswordEncrypted = $true
48+
$encryptedPassword = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $clusterConnectionParameters
49+
if ($encryptedPassword)
50+
{
51+
$password = $encryptedPassword
52+
$isPasswordEncrypted = $true
53+
}
5054
}
5155

5256
$appManifestPath = Join-Path $ApplicationPackagePath "ApplicationManifest.xml"

Tasks/ServiceFabricDeploy/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 4,
19-
"Patch": 2
19+
"Patch": 3
2020
},
2121
"demands": [
2222
"Cmd"

Tasks/ServiceFabricDeploy/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 4,
19-
"Patch": 2
19+
"Patch": 3
2020
},
2121
"demands": [
2222
"Cmd"

0 commit comments

Comments
 (0)