mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Migrate kubeconfig path only if file does not exist
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
9ac5f21cd4
commit
2cef45dac2
@ -3,6 +3,7 @@
|
|||||||
import { migration } from "../migration-wrapper";
|
import { migration } from "../migration-wrapper";
|
||||||
import { ClusterModel, ClusterStore } from "../../common/cluster-store";
|
import { ClusterModel, ClusterStore } from "../../common/cluster-store";
|
||||||
import { getAppVersion } from "../../common/utils/app-version";
|
import { getAppVersion } from "../../common/utils/app-version";
|
||||||
|
import fs from "fs"
|
||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: getAppVersion(), // Run always after upgrade
|
version: getAppVersion(), // Run always after upgrade
|
||||||
@ -19,8 +20,10 @@ export default migration({
|
|||||||
/**
|
/**
|
||||||
* replace snap version with 'current' in kubeconfig path
|
* replace snap version with 'current' in kubeconfig path
|
||||||
*/
|
*/
|
||||||
const kubeconfigPath = cluster.kubeConfigPath.replace(/\/snap\/kontena-lens\/[0-9]*\//, "/snap/kontena-lens/current/")
|
if (!fs.existsSync(cluster.kubeConfigPath)) {
|
||||||
cluster.kubeConfigPath = kubeconfigPath
|
const kubeconfigPath = cluster.kubeConfigPath.replace(/\/snap\/kontena-lens\/[0-9]*\//, "/snap/kontena-lens/current/")
|
||||||
|
cluster.kubeConfigPath = kubeconfigPath
|
||||||
|
}
|
||||||
return cluster;
|
return cluster;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user