Merge pull request #9414 from prezha/delete-context-when-stopped

Delete context when stopped
pull/9423/head
Medya Ghazizadeh 2020-10-08 15:12:50 -05:00 committed by GitHub
commit c459fea74d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View File

@ -114,8 +114,8 @@ func stopProfile(profile string) int {
}
if !keepActive {
if err := kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()); err != nil {
exit.Error(reason.HostKubeconfigUnset, "update config", err)
if err := kubeconfig.DeleteContext(profile, kubeconfig.PathFromEnv()); err != nil {
exit.Error(reason.HostKubeconfigDeleteCtx, "delete ctx", err)
}
}

View File

@ -200,17 +200,18 @@ var (
Issues: []int{9165},
}
HostCurrentUser = Kind{ID: "HOST_CURRENT_USER", ExitCode: ExHostConfig}
HostDelCache = Kind{ID: "HOST_DEL_CACHE", ExitCode: ExHostError}
HostKillMountProc = Kind{ID: "HOST_KILL_MOUNT_PROC", ExitCode: ExHostError}
HostKubeconfigUnset = Kind{ID: "HOST_KUBECNOFIG_UNSET", ExitCode: ExHostConfig}
HostKubeconfigUpdate = Kind{ID: "HOST_KUBECONFIG_UPDATE", ExitCode: ExHostConfig}
HostKubectlProxy = Kind{ID: "HOST_KUBECTL_PROXY", ExitCode: ExHostError}
HostMountPid = Kind{ID: "HOST_MOUNT_PID", ExitCode: ExHostError}
HostPathMissing = Kind{ID: "HOST_PATH_MISSING", ExitCode: ExHostNotFound}
HostPathStat = Kind{ID: "HOST_PATH_STAT", ExitCode: ExHostError}
HostPurge = Kind{ID: "HOST_PURGE", ExitCode: ExHostError}
HostSaveProfile = Kind{ID: "HOST_SAVE_PROFILE", ExitCode: ExHostConfig}
HostCurrentUser = Kind{ID: "HOST_CURRENT_USER", ExitCode: ExHostConfig}
HostDelCache = Kind{ID: "HOST_DEL_CACHE", ExitCode: ExHostError}
HostKillMountProc = Kind{ID: "HOST_KILL_MOUNT_PROC", ExitCode: ExHostError}
HostKubeconfigUnset = Kind{ID: "HOST_KUBECNOFIG_UNSET", ExitCode: ExHostConfig}
HostKubeconfigUpdate = Kind{ID: "HOST_KUBECONFIG_UPDATE", ExitCode: ExHostConfig}
HostKubeconfigDeleteCtx = Kind{ID: "HOST_KUBECONFIG_DELETE_CTX", ExitCode: ExHostConfig}
HostKubectlProxy = Kind{ID: "HOST_KUBECTL_PROXY", ExitCode: ExHostError}
HostMountPid = Kind{ID: "HOST_MOUNT_PID", ExitCode: ExHostError}
HostPathMissing = Kind{ID: "HOST_PATH_MISSING", ExitCode: ExHostNotFound}
HostPathStat = Kind{ID: "HOST_PATH_STAT", ExitCode: ExHostError}
HostPurge = Kind{ID: "HOST_PURGE", ExitCode: ExHostError}
HostSaveProfile = Kind{ID: "HOST_SAVE_PROFILE", ExitCode: ExHostConfig}
ProviderNotFound = Kind{ID: "PROVIDER_NOT_FOUND", ExitCode: ExProviderNotFound}
ProviderUnavailable = Kind{ID: "PROVIDER_UNAVAILABLE", ExitCode: ExProviderNotFound, Style: style.Shrug}