Skip to content

Commit ac30c26

Browse files
committed
Return JobHistoryId on failures
1 parent cc3a1b8 commit ac30c26

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

IISWithBindings/Jobs/Inventory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
5555
return new JobResult
5656
{
5757
Result = OrchestratorJobStatusJobResult.Failure,
58+
JobHistoryId = config.JobHistoryId,
5859
FailureMessage =
5960
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: failed."
6061
};
@@ -66,6 +67,7 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
6667
return new JobResult
6768
{
6869
Result = OrchestratorJobStatusJobResult.Warning,
70+
JobHistoryId = config.JobHistoryId,
6971
FailureMessage =
7072
$"Inventory on server {config.CertificateStoreDetails.ClientMachine} did not find any bindings."
7173
};
@@ -113,6 +115,7 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
113115
return new JobResult
114116
{
115117
Result = OrchestratorJobStatusJobResult.Failure,
118+
JobHistoryId = config.JobHistoryId,
116119
FailureMessage =
117120
$"Unable to open remote certificate store: {psEx.Message}"
118121
};
@@ -123,6 +126,7 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
123126
return new JobResult
124127
{
125128
Result = OrchestratorJobStatusJobResult.Failure,
129+
JobHistoryId = config.JobHistoryId,
126130
FailureMessage =
127131
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: {ex.Message}"
128132
};

IISWithBindings/Jobs/Management.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ private JobResult PerformRemoval(ManagementJobConfiguration config)
9999
if (foundBindings.Count == 0)
100100
return new JobResult
101101
{
102-
Result = OrchestratorJobStatusJobResult.Failure,
102+
Result = OrchestratorJobStatusJobResult.Failure,
103+
JobHistoryId = config.JobHistoryId,
103104
FailureMessage =
104105
$"Site {protocol} binding for Site {siteName} on server {config.CertificateStoreDetails.ClientMachine} not found."
105106
};
@@ -119,7 +120,8 @@ private JobResult PerformRemoval(ManagementJobConfiguration config)
119120
if (ps.HadErrors)
120121
return new JobResult
121122
{
122-
Result = OrchestratorJobStatusJobResult.Failure,
123+
Result = OrchestratorJobStatusJobResult.Failure,
124+
JobHistoryId = config.JobHistoryId,
123125
FailureMessage =
124126
$"Failed to remove {protocol} binding for Site {siteName} on server {config.CertificateStoreDetails.ClientMachine} not found."
125127
};
@@ -141,7 +143,8 @@ private JobResult PerformRemoval(ManagementJobConfiguration config)
141143
_logger.LogTrace(ex.Message);
142144
return new JobResult
143145
{
144-
Result = OrchestratorJobStatusJobResult.Failure,
146+
Result = OrchestratorJobStatusJobResult.Failure,
147+
JobHistoryId = config.JobHistoryId,
145148
FailureMessage =
146149
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: {ex.Message}"
147150
};
@@ -207,7 +210,8 @@ function InstallPfxToMachineStore([byte[]]$bytes, [string]$password, [string]$st
207210
if (ps.HadErrors)
208211
return new JobResult
209212
{
210-
Result = OrchestratorJobStatusJobResult.Failure,
213+
Result = OrchestratorJobStatusJobResult.Failure,
214+
JobHistoryId = config.JobHistoryId,
211215
FailureMessage =
212216
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: {ps.Streams.Error.ReadAll().First().ErrorDetails.Message}"
213217
};
@@ -296,7 +300,8 @@ function InstallPfxToMachineStore([byte[]]$bytes, [string]$password, [string]$st
296300
if (ps.HadErrors)
297301
return new JobResult
298302
{
299-
Result = OrchestratorJobStatusJobResult.Failure,
303+
Result = OrchestratorJobStatusJobResult.Failure,
304+
JobHistoryId = config.JobHistoryId,
300305
FailureMessage =
301306
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: {ps.Streams.Error.ReadAll().First().ErrorDetails.Message}"
302307
};
@@ -317,6 +322,7 @@ function InstallPfxToMachineStore([byte[]]$bytes, [string]$password, [string]$st
317322
return new JobResult
318323
{
319324
Result = OrchestratorJobStatusJobResult.Failure,
325+
JobHistoryId = config.JobHistoryId,
320326
FailureMessage =
321327
$"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: {ex.Message}"
322328
};

0 commit comments

Comments
 (0)