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,
key: 'keyId',
default: defaults.keyId,
validate: function validateKeyId(value, valCb) {
// First try as a fingerprint.
try {

View File

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