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

View File

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

View File

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