Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Key Id cannot be loaded from ssh-agent, need to be specified either a…

…s ENV variable or explicit argument.
  • Loading branch information...
commit 4226fa3ef426b79f8906a1d9687ed35434506967 1 parent 27916d4
@kusor kusor authored
Showing with 21 additions and 17 deletions.
  1. +21 −17 lib/cli_common.js
View
38 lib/cli_common.js
@@ -70,7 +70,6 @@ function loadKeyFromAgent(parsed, callback) {
for (var i = 0; i < keys.length; i++) {
if (keys[i].type !== 'ssh-rsa')
continue;
-
var comment = keys[i].comment.split('/');
if (p[p.length - 1] === comment[comment.length - 1]) {
if (parsed.debug) {
@@ -202,25 +201,30 @@ module.exports = {
return loadKeyFromAgent(parsed, function (_parsed) {
- if (_parsed) {
- if (parsed.debug) {
- console.log('Found private key in SSH-Agent: %s', parsed.keyId);
+ if (_parsed) {
+ if (typeof (parsed.keyId) === 'undefined') {
+ usage(usageStr, 1,
+ 'Either -k or (env) SDC_CLI_KEY_ID must be specified');
+ }
+ if (parsed.debug) {
+ console.log('Found private key in SSH-Agent: %s',
+ parsed.keyId);
+ }
+ return callback(_parsed);
}
- return callback(_parsed);
- }
- return loadSigningKey(parsed, function (_parsed2) {
- if (!_parsed2) {
- console.error('Unable to load a private key' +
- ' for signing (not found)');
- process.exit(2);
- }
+ return loadSigningKey(parsed, function (_parsed2) {
+ if (!_parsed2) {
+ console.error('Unable to load a private key' +
+ ' for signing (not found)');
+ process.exit(2);
+ }
- if (parsed.debug) {
- console.log('Using private key from: %s', parsed.identity);
- }
- return callback(_parsed2);
- });
+ if (parsed.debug) {
+ console.log('Using private key from: %s', parsed.identity);
+ }
+ return callback(_parsed2);
+ });
});
},
Please sign in to comment.
Something went wrong with that request. Please try again.