mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Don't change permissions when deleting a cluster (#3798)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f68cbabbc9
commit
b43086a386
@ -348,7 +348,6 @@
|
|||||||
"jest-canvas-mock": "^2.3.1",
|
"jest-canvas-mock": "^2.3.1",
|
||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"jest-mock-extended": "^1.0.16",
|
"jest-mock-extended": "^1.0.16",
|
||||||
"json-to-pretty-yaml": "^1.2.2",
|
|
||||||
"make-plural": "^6.2.2",
|
"make-plural": "^6.2.2",
|
||||||
"mini-css-extract-plugin": "^1.6.0",
|
"mini-css-extract-plugin": "^1.6.0",
|
||||||
"node-gyp": "7.1.2",
|
"node-gyp": "7.1.2",
|
||||||
|
|||||||
@ -19,25 +19,18 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { KubeConfig } from "@kubernetes/client-node";
|
import { dumpYaml, KubeConfig } from "@kubernetes/client-node";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import tempy from "tempy";
|
|
||||||
import * as lockFile from "proper-lockfile";
|
import * as lockFile from "proper-lockfile";
|
||||||
import YAML from "json-to-pretty-yaml";
|
|
||||||
import { noop } from "../../utils";
|
|
||||||
|
|
||||||
export async function saveKubeconfig(config: KubeConfig, path: string) {
|
export async function saveKubeconfig(config: KubeConfig, path: string) {
|
||||||
const tmpFilePath = tempy.file();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const release = await lockFile.lock(path);
|
const release = await lockFile.lock(path);
|
||||||
const contents = YAML.stringify(JSON.parse(config.exportConfig()));
|
const contents = dumpYaml(JSON.parse(config.exportConfig()));
|
||||||
|
|
||||||
await fs.promises.writeFile(tmpFilePath, contents);
|
await fs.promises.writeFile(path, contents);
|
||||||
await fs.promises.rename(tmpFilePath, path);
|
await release();
|
||||||
release();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await fs.unlink(tmpFilePath, noop);
|
|
||||||
throw new Error(`Failed to acquire lock file.\n${e}`);
|
throw new Error(`Failed to acquire lock file.\n${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
yarn.lock
18
yarn.lock
@ -8628,14 +8628,6 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
|
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
|
||||||
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
|
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
|
||||||
|
|
||||||
json-to-pretty-yaml@^1.2.2:
|
|
||||||
version "1.2.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b"
|
|
||||||
integrity sha1-9M0L0KXo/h3yWq9boRiwmf2ZLVs=
|
|
||||||
dependencies:
|
|
||||||
remedial "^1.0.7"
|
|
||||||
remove-trailing-spaces "^1.0.6"
|
|
||||||
|
|
||||||
json3@^3.3.3:
|
json3@^3.3.3:
|
||||||
version "3.3.3"
|
version "3.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81"
|
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81"
|
||||||
@ -12101,21 +12093,11 @@ relateurl@^0.2.7:
|
|||||||
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
||||||
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
|
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
|
||||||
|
|
||||||
remedial@^1.0.7:
|
|
||||||
version "1.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0"
|
|
||||||
integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg==
|
|
||||||
|
|
||||||
remove-trailing-separator@^1.0.1:
|
remove-trailing-separator@^1.0.1:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
|
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
|
||||||
integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8=
|
integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8=
|
||||||
|
|
||||||
remove-trailing-spaces@^1.0.6:
|
|
||||||
version "1.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/remove-trailing-spaces/-/remove-trailing-spaces-1.0.8.tgz#4354d22f3236374702f58ee373168f6d6887ada7"
|
|
||||||
integrity sha512-O3vsMYfWighyFbTd8hk8VaSj9UAGENxAtX+//ugIst2RMk5e03h6RoIS+0ylsFxY1gvmPuAY/PO4It+gPEeySA==
|
|
||||||
|
|
||||||
renderkid@^2.0.1:
|
renderkid@^2.0.1:
|
||||||
version "2.0.3"
|
version "2.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149"
|
resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user