Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using Azure.Sdk.Tools.SecretRotation.Configuration;
using Azure.Sdk.Tools.SecretRotation.Core;
using Microsoft.Extensions.Logging;

namespace Azure.Sdk.Tools.SecretManagement.Cli.Commands;

Expand All @@ -25,10 +26,24 @@ protected override async Task HandleCommandAsync(ILogger logger, RotationConfigu
var timeProvider = new TimeProvider();

IEnumerable<RotationPlan> plans = rotationConfiguration.GetAllRotationPlans(logger, timeProvider);
bool success = true;

foreach (RotationPlan plan in plans)
{
await plan.ExecuteAsync(onlyRotateExpiring, whatIf);
try
{
await plan.ExecuteAsync(onlyRotateExpiring, whatIf);
}
catch (Exception ex)
{
logger.LogError(ex, "Exception thrown while executing plan {PlanName}", plan.Name);
success = false;
}
}

if(!success)
{
throw new RotationException("Errors occurred while rotating secrets.");
}
}
}