Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
  • Loading branch information
vparfonov committed Feb 25, 2019
1 parent dc16d0f commit 1c4895d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class CheApiServiceImpl implements CheApiService {

throw new Error(`Unable to generate SSH Key for ${service}:${name}`);
} catch (e) {
throw new Error('Unable to create Che API REST Client');
console.error(e);
throw new Error(e);
}
}

Expand All @@ -131,6 +132,7 @@ export class CheApiServiceImpl implements CheApiService {

throw new Error('Unable to create SSH Key');
} catch (e) {
console.error(e);
throw new Error(e);
}
}
Expand All @@ -144,6 +146,7 @@ export class CheApiServiceImpl implements CheApiService {

throw new Error(`Unable to get SSH Key for ${service}:${name}`);
} catch (e) {
console.error(e);
throw new Error(e);
}
}
Expand All @@ -156,6 +159,7 @@ export class CheApiServiceImpl implements CheApiService {
}
throw new Error(`Unable to get SSH Keys for ${service}`);
} catch (e) {
console.error(e);
throw new Error(e);
}
}
Expand All @@ -168,6 +172,7 @@ export class CheApiServiceImpl implements CheApiService {
}
throw new Error(`Unable to delete SSH Key for ${service}:${name}`);
} catch (e) {
console.error(e);
throw new Error(e);
}
}
Expand Down
28 changes: 5 additions & 23 deletions plugins/ssh-plugin/src/node/ssh-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,52 +89,34 @@ export class RemoteSshKeyManager implements SshKeyManager {
* @inheritDoc
*/
generate(service: string, name: string): Promise<cheApi.ssh.SshPair> {
return new Promise<cheApi.ssh.SshPair>((resolve, reject) => {
che.ssh.generate(service, name)
.then(value => resolve(value))
.catch(reason => reject(reason));
});
return che.ssh.generate(service, name);
}

/**
* @inheritDoc
*/
create(sshKeyPair: cheApi.ssh.SshPair): Promise<void> {
return new Promise<void>((resolve, reject) => {
che.ssh.create(sshKeyPair)
.then(value => resolve(value))
.catch(reason => reject(reason));
});
return che.ssh.create(sshKeyPair);
}

/**
* @inheritDoc
*/
getAll(service: string): Promise<cheApi.ssh.SshPair[]> {
return new Promise<cheApi.ssh.SshPair[]>((resolve, reject) =>
che.ssh.getAll(service)
.then(value => resolve(value))
.catch(reason => reject(reason)));
return che.ssh.getAll(service);
}

/**
* @inheritDoc
*/
get(service: string, name: string): Promise<cheApi.ssh.SshPair> {
return new Promise<cheApi.ssh.SshPair>((resolve, reject) =>
che.ssh
.get(service, name)
.then(value => resolve(value))
.catch(reason => reject(reason)));
return che.ssh.get(service, name);
}

/**
* @inheritDoc
*/
delete(service: string, name: string): Promise<void> {
return new Promise<void>((resolve, reject) =>
che.ssh.deleteKey(service, name)
.then(value => resolve(value))
.catch(reason => reject(reason)));
return che.ssh.deleteKey(service, name);
}
}

0 comments on commit 1c4895d

Please sign in to comment.