mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Don't error out if we can't find resources from helm in our cluster, and handle "blank" output from kubectl gracefully. (#6039)
This commit is contained in:
parent
3f2010a6b6
commit
5249a8ebed
@ -194,6 +194,11 @@ async function getResources(name: string, namespace: string, kubeconfigPath: str
|
|||||||
"--kubeconfig", kubeconfigPath,
|
"--kubeconfig", kubeconfigPath,
|
||||||
"-f", "-",
|
"-f", "-",
|
||||||
"--output", "json",
|
"--output", "json",
|
||||||
|
// Temporary workaround for https://github.com/lensapp/lens/issues/6031
|
||||||
|
// and other potential issues where resources can't be found. Showing
|
||||||
|
// no resources is better than the app hard-locking, and at least
|
||||||
|
// the helm metadata is shown.
|
||||||
|
"--ignore-not-found",
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -208,9 +213,13 @@ async function getResources(name: string, namespace: string, kubeconfigPath: str
|
|||||||
.on("exit", (code, signal) => {
|
.on("exit", (code, signal) => {
|
||||||
if (typeof code === "number") {
|
if (typeof code === "number") {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
const output = json.parse(stdout) as { items: JsonObject[] };
|
if (stdout === "") {
|
||||||
|
resolve([]);
|
||||||
|
} else {
|
||||||
|
const output = json.parse(stdout) as { items: JsonObject[] };
|
||||||
|
|
||||||
resolve(output.items);
|
resolve(output.items);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reject(stderr);
|
reject(stderr);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user