1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix addCustomRepo getResources error output

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-12-09 11:38:06 -05:00
parent 844b7be954
commit e7045727d4
3 changed files with 9 additions and 5 deletions

View File

@ -223,15 +223,16 @@ async function getResources(name: string, namespace: string, kubeconfigPath: str
return new Promise((resolve, reject) => {
let stdout = "";
let stderr = "";
const kubectl = execFile(kubectlPath, kubectlArgs);
kubectl
.on("exit", (code, signal) => {
if (typeof code === "number") {
if (code) {
reject(new Error(`Kubectl exited with code ${code}`));
} else {
if (code === 0) {
resolve(JSON.parse(stdout).items);
} else {
reject(stderr);
}
} else {
reject(new Error(`Kubectl exited with signal ${signal}`));
@ -239,6 +240,7 @@ async function getResources(name: string, namespace: string, kubeconfigPath: str
})
.on("error", reject);
kubectl.stderr.on("data", output => stderr += output);
kubectl.stdout.on("data", output => stdout += output);
kubectl.stdin.write(helmOutput);
kubectl.stdin.end();

View File

@ -178,6 +178,8 @@ export class HelmRepoManager extends Singleton {
const args = [
"repo",
"add",
name,
url,
];
if (insecureSkipTlsVerify) {

View File

@ -121,7 +121,7 @@ export class AddHelmRepoDialog extends React.Component<Props> {
<div className="flex gaps align-center">
<Input
placeholder={placeholder}
validators = {isPath}
validators={isPath}
className="box grow"
value={this.getFilePath(fileType)}
onChange={v => this.setFilepath(fileType, v)}
@ -172,7 +172,7 @@ export class AddHelmRepoDialog extends React.Component<Props> {
close={this.close}
>
<Wizard header={header} done={this.close}>
<WizardStep contentClass="flow column" nextLabel="Add" next={()=>{this.addCustomRepo();}}>
<WizardStep contentClass="flow column" nextLabel="Add" next={() => this.addCustomRepo()}>
<div className="flex column gaps">
<Input
autoFocus required