summaryrefslogtreecommitdiffstats
path: root/src/main.lib/Services/NotificationService.cs
diff options
context:
space:
mode:
authorWouter Tinus <win.acme.simple@gmail.com>2019-12-14 09:02:22 +0100
committerWouter Tinus <win.acme.simple@gmail.com>2019-12-14 09:02:22 +0100
commit598a42efffcd11b308bfc7cb2a15e021a99e442d (patch)
tree8b7afedd3d662fac603a8b7c22791b67b6372b28 /src/main.lib/Services/NotificationService.cs
parentf084f256ed0fda699acdb86c51f95b1e5478c34f (diff)
downloadletsencrypt-win-simple-598a42efffcd11b308bfc7cb2a15e021a99e442d.zip
letsencrypt-win-simple-598a42efffcd11b308bfc7cb2a15e021a99e442d.tar.gz
letsencrypt-win-simple-598a42efffcd11b308bfc7cb2a15e021a99e442d.tar.bz2
null annotations progress
Diffstat (limited to 'src/main.lib/Services/NotificationService.cs')
-rw-r--r--src/main.lib/Services/NotificationService.cs29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/main.lib/Services/NotificationService.cs b/src/main.lib/Services/NotificationService.cs
index 5ba2f54..f9e4ee6 100644
--- a/src/main.lib/Services/NotificationService.cs
+++ b/src/main.lib/Services/NotificationService.cs
@@ -48,14 +48,14 @@ namespace PKISharp.WACS.Services
/// </summary>
/// <param name="runLevel"></param>
/// <param name="renewal"></param>
- internal void NotifyFailure(RunLevel runLevel, Renewal renewal, string errorMessage)
+ internal void NotifyFailure(RunLevel runLevel, Renewal renewal, string? errorMessage)
{
// Do not send emails when running interactively
_log.Error("Renewal for {friendlyName} failed, will retry on next run", renewal.LastFriendlyName);
if (runLevel.HasFlag(RunLevel.Unattended))
{
_email.Send("Error processing certificate renewal",
- $"<p>Renewal for <b>{renewal.LastFriendlyName}</b> failed with error <b>{errorMessage}</b>, will retry on next run.</p> {NotificationInformation(renewal)}",
+ $"<p>Renewal for <b>{renewal.LastFriendlyName}</b> failed with error <b>{errorMessage ?? "(null)"}</b>, will retry on next run.</p> {NotificationInformation(renewal)}",
MailPriority.High);
}
}
@@ -67,11 +67,26 @@ namespace PKISharp.WACS.Services
var extraMessage = "";
extraMessage += $"<p>Hosts: {NotificationHosts(renewal)}</p>";
extraMessage += "<p><table><tr><td>Plugins</td><td></td></tr>";
- extraMessage += $"<tr><td>Target: </td><td> {renewal.TargetPluginOptions.Name}</td></tr>";
- extraMessage += $"<tr><td>Validation: </td><td> {renewal.ValidationPluginOptions.Name}</td></tr>";
- extraMessage += $"<tr><td>CSR: </td><td> {renewal.CsrPluginOptions.Name}</td></tr>";
- extraMessage += $"<tr><td>Store: </td><td> {string.Join(", ", renewal.StorePluginOptions.Select(x => x.Name))}</td></tr>";
- extraMessage += $"<tr><td>Installation: </td><td> {string.Join(", ", renewal.InstallationPluginOptions.Select(x => x.Name))}</td></tr>";
+ if (renewal.TargetPluginOptions != null)
+ {
+ extraMessage += $"<tr><td>Target: </td><td> {renewal.TargetPluginOptions.Name}</td></tr>";
+ }
+ if (renewal.ValidationPluginOptions != null)
+ {
+ extraMessage += $"<tr><td>Validation: </td><td> {renewal.ValidationPluginOptions.Name}</td></tr>";
+ }
+ if (renewal.CsrPluginOptions != null)
+ {
+ extraMessage += $"<tr><td>CSR: </td><td> {renewal.CsrPluginOptions.Name}</td></tr>";
+ }
+ if (renewal.StorePluginOptions != null)
+ {
+ extraMessage += $"<tr><td>Store: </td><td> {string.Join(", ", renewal.StorePluginOptions.Select(x => x.Name))}</td></tr>";
+ }
+ if (renewal.InstallationPluginOptions != null)
+ {
+ extraMessage += $"<tr><td>Installation: </td><td> {string.Join(", ", renewal.InstallationPluginOptions.Select(x => x.Name))}</td></tr>";
+ }
extraMessage += "</table></p>";
return extraMessage;
}