Skip to content

Commit 7156b2c

Browse files
committed
stop: fix the warn message in case of nil error
looks like it is missed during 0342835 one and when crc is stopped, it show following warn message. ``` WARN Failed to remove crc contexts from kubeconfig: <nil> Stopped the instance ``` This PR will make sure to handle nil error properly.
1 parent 0c5b687 commit 7156b2c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/crc/machine/stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func (client *client) Stop() (state.State, error) {
1414
defer func(input, output string) {
1515
err := cleanKubeconfig(input, output)
16-
if !errors.Is(err, os.ErrNotExist) {
16+
if err != nil && !errors.Is(err, os.ErrNotExist) {
1717
logging.Warnf("Failed to remove crc contexts from kubeconfig: %v", err)
1818
}
1919
}(getGlobalKubeConfigPath(), getGlobalKubeConfigPath())

0 commit comments

Comments
 (0)