some cosmetics
This commit is contained in:
@ -8,7 +8,11 @@ export let ssh = () => {
|
||||
let done = plugins.q.defer();
|
||||
sshInstance = new plugins.smartssh.SshInstance();
|
||||
plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshEnv);
|
||||
sshInstance.writeToDisk();
|
||||
if(!process.env.NPMTS_TEST){
|
||||
sshInstance.writeToDisk()
|
||||
} else {
|
||||
plugins.beautylog.log("In test mode, so not storing SSH keys to disk!");
|
||||
};
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
@ -16,14 +20,23 @@ export let ssh = () => {
|
||||
let evaluateSshEnv = (sshkeyEnvVarArg) => {
|
||||
let resultArray = sshRegex.exec(sshkeyEnvVarArg);
|
||||
let sshKey = new plugins.smartssh.SshKey();
|
||||
|
||||
if(notUndefined(resultArray[1])) sshKey.host = resultArray[1];
|
||||
if(notUndefined(resultArray[2])) sshKey.privKeyBase64 = resultArray[2];
|
||||
if(notUndefined(resultArray[3])) sshKey.pubKeyBase64 = resultArray[3];
|
||||
plugins.beautylog.info("Found SSH identity for " + resultArray[1]);
|
||||
if(notUndefined(resultArray[1])){
|
||||
plugins.beautylog.log("---> host defined!")
|
||||
sshKey.host = resultArray[1];
|
||||
}
|
||||
if(notUndefined(resultArray[2])){
|
||||
plugins.beautylog.log("---> privKey defined!")
|
||||
sshKey.privKeyBase64 = resultArray[2];
|
||||
};
|
||||
if(notUndefined(resultArray[3])){
|
||||
"---> pubKey defined!"
|
||||
sshKey.pubKeyBase64 = resultArray[3];
|
||||
};
|
||||
|
||||
sshInstance.addKey(sshKey);
|
||||
};
|
||||
|
||||
let notUndefined = (stringArg:string) => {
|
||||
return (stringArg && stringArg != "undefined" && stringArg != "##")
|
||||
return (stringArg && stringArg != "undefined" && stringArg != "##");
|
||||
}
|
Reference in New Issue
Block a user