joyent/node-triton#180 `triton profile docker-setup` fails with a non-MD5 keyId

Reviewed by: Todd Whiteman <todd.whiteman@joyent.com>
Approved by: Todd Whiteman <todd.whiteman@joyent.com>
This commit is contained in:
Trent Mick 2017-02-21 08:56:04 -08:00
parent dba8915d4f
commit 46ded211f3
2 changed files with 5 additions and 4 deletions

View File

@ -259,6 +259,7 @@ function _createProfile(opts, cb) {
}, { }, {
desc: keyIdDesc, desc: keyIdDesc,
key: 'keyId', key: 'keyId',
default: defaults.keyId,
validate: function validateKeyId(value, valCb) { validate: function validateKeyId(value, valCb) {
// First try as a fingerprint. // First try as a fingerprint.
try { try {

View File

@ -324,9 +324,10 @@ function profileDockerSetup(opts, cb) {
} }
var kr = new auth.KeyRing(); var kr = new auth.KeyRing();
kr.list(function (listErr, keyMap) { var profileFp = sshpk.parseFingerprint(tritonapi.profile.keyId);
if (listErr) { kr.find(profileFp, function (findErr, keyPairs) {
next(listErr); if (findErr) {
next(findErr);
return; return;
} }
@ -334,7 +335,6 @@ function profileDockerSetup(opts, cb) {
* If our keyId was found, and with the 'homedir' plugin, then * If our keyId was found, and with the 'homedir' plugin, then
* we should have access to the private key (modulo unlocking). * we should have access to the private key (modulo unlocking).
*/ */
var keyPairs = keyMap[tritonapi.profile.keyId] || [];
var homedirKeyPair; var homedirKeyPair;
for (var i = 0; i < keyPairs.length; i++) { for (var i = 0; i < keyPairs.length; i++) {
if (keyPairs[i].plugin === 'homedir') { if (keyPairs[i].plugin === 'homedir') {