Skip to content

Commit

Permalink
adding remove logs aggregator container function when it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Dec 18, 2023
1 parent 65a64f3 commit 43c6300
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ func CreateLogsAggregator(
}
if found {
logrus.Debugf("Found existing logs aggregator; cannot start a new one.")
logsAggregatorObj, _, err := getLogsAggregatorObjectAndContainerId(ctx, dockerManager)
logsAggregatorObj, containerId, err := getLogsAggregatorObjectAndContainerId(ctx, dockerManager)
if err != nil {
return nil, nil, stacktrace.Propagate(err, "An error occurred getting existing logs aggregator.")
}
return logsAggregatorObj, nil, nil
removeCtx := context.Background()
removeLogsAggregatorContainerFunc := func() {
if err := dockerManager.RemoveContainer(removeCtx, containerId); err != nil {
logrus.Errorf(
"Something failed while trying to remove the logs aggregator container with ID '%v'. Error was:\n%v",
containerId,
err)
logrus.Errorf("ACTION REQUIRED: You'll need to manually remove the logs aggregator server with Docker container ID '%v'!!!!!!", containerId)
}
}
return logsAggregatorObj, removeLogsAggregatorContainerFunc, nil
}

logsAggregatorNetwork, err := shared_helpers.GetEngineAndLogsComponentsNetwork(ctx, dockerManager)
Expand Down

0 comments on commit 43c6300

Please sign in to comment.