Skip to content

Commit

Permalink
fix: nil pointer error found in the kurtosis clean -a cmd, adding r…
Browse files Browse the repository at this point in the history
…emove reverse proxy container function when it already exists (#1995)

## Description:
fix: nil pointer error found in the `kurtosis clean -a` cmd, adding
remove reverse proxy container function when it already exists

## Is this change user-facing?
YES

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
  • Loading branch information
leoporoli committed Dec 20, 2023
1 parent 509c508 commit 64eff3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Expand Up @@ -32,9 +32,16 @@ func CreateReverseProxy(
}
if found {
logrus.Debugf("Found existing reverse proxy; cannot start a new one.")
reverseProxyObj, _, getProxyObjErr := getReverseProxyObjectAndContainerId(ctx, dockerManager)
reverseProxyObj, proxyContainerId, getProxyObjErr := getReverseProxyObjectAndContainerId(ctx, dockerManager)
if getProxyObjErr == nil {
return reverseProxyObj, nil, nil
removeProxyFunc := func() {
removeCtx := context.Background()
if err := dockerManager.RemoveContainer(removeCtx, proxyContainerId); err != nil {
logrus.Errorf("an error occurred to remove the current reverse proxy container with ID '%s' failed. Error was:\n%v", proxyContainerId, err)
logrus.Errorf("ACTION REQUIRED: You'll need to manually remove the reverse proxy server with Docker container ID '%v'!!!!!!", proxyContainerId)
}
}
return reverseProxyObj, removeProxyFunc, nil
}
logrus.Debugf("Something failed while trying to create the reverse proxy object using container with ID '%s'. Error was:\n%s", proxyDockerContainer.GetId(), getProxyObjErr.Error())
logrus.Debugf("Destroying the failing reverse proxy to create a new one...")
Expand Down
Expand Up @@ -16,7 +16,7 @@ const (
func DestroyReverseProxy(ctx context.Context, dockerManager *docker_manager.DockerManager) error {
_, maybeReverseProxyContainerId, err := getReverseProxyObjectAndContainerId(ctx, dockerManager)
if err != nil {
logrus.Warnf("Attempted to destroy reverse proxy but no reverse proxy container was found.")
logrus.Warnf("Attempted to destroy reverse proxy but no reverse proxy container was found. Error was:\n%s", err.Error())
return nil
}

Expand Down

0 comments on commit 64eff3e

Please sign in to comment.