Skip to content

Commit

Permalink
Add nil check for current docker context (#68)
Browse files Browse the repository at this point in the history
* Add nil check for current docker contxt

Signed-off-by: Evan Harris <echarris@smcm.edu>

* Rm comments

Signed-off-by: Evan Harris <echarris@smcm.edu>

---------

Signed-off-by: Evan Harris <echarris@smcm.edu>
  • Loading branch information
eharris128 authored Oct 27, 2024
1 parent 5b8fa39 commit 4fd3971
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/crt/docker/dockerclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"

"github.com/fsouza/go-dockerclient"
docker "github.com/fsouza/go-dockerclient"
log "github.com/sirupsen/logrus"

"github.com/mintoolkit/mint/pkg/app/master/config"
Expand Down Expand Up @@ -210,8 +210,12 @@ func New(config *config.DockerClient) (*docker.Client, error) {
//so we need to lookup the context first to extract its connection info
var currentDockerContext string
if dcf, err := ReadConfigFile(ConfigFilePath()); err == nil {
currentDockerContext = dcf.CurrentContext
log.Debugf("dockerclient.New: currentDockerContext - '%s'", currentDockerContext)
if dcf == nil {
log.Debug("dockerclient.New: No config file.")
} else {
currentDockerContext = dcf.CurrentContext
log.Debugf("dockerclient.New: currentDockerContext - '%s'", currentDockerContext)
}
} else {
log.Debugf("dockerclient.New: ReadConfigFile error - %v", err)
}
Expand Down

0 comments on commit 4fd3971

Please sign in to comment.