ctl.go: Adds a call to DeleteFile to handle the (rare) case where WriteKubeConfig fails.
resource_ops.go: Moves defer io.DeleteFile(...) call to handle the (rare) case where Write or Close fail.
Admittedly, these are likely to be rare: it's unlikely that writing to a file would fail, when that file was already successfully created earlier in the function.
Fixes #568
See parent issue for details of the problem
This PR:
ctl.go
: Adds a call toDeleteFile
to handle the (rare) case whereWriteKubeConfig
fails.resource_ops.go
: Movesdefer io.DeleteFile(...)
call to handle the (rare) case where Write or Close fail.Admittedly, these are likely to be rare: it's unlikely that writing to a file would fail, when that file was already successfully created earlier in the function.