Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
fix rest server by backing out importCard change (#3560)
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Kelsey <[email protected]>

#closes 3555
  • Loading branch information
Dave Kelsey authored and nklincoln committed Mar 9, 2018
1 parent bbb20f8 commit 9e0f7f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/composer-admin/lib/adminconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class AdminConnection {
return connectionManager.removeIdentity(connectionProfileData.name, connectionProfileData, card.getUserName());
}
})
.then(() => {
return this.cardStore.put(name, card);
})
.then(() => {
// if we have a certificate and optionally a privateKey we should ask the connection manager to import
let certificate = card.getCredentials().certificate;
Expand All @@ -98,9 +101,6 @@ class AdminConnection {
return connectionManager.importIdentity(connectionProfileData.name, connectionProfileData, card.getUserName(), certificate, privateKey);
}
})
.then(() => {
return this.cardStore.put(name, card);
})
.then(() => {
return updated;
});
Expand Down
11 changes: 0 additions & 11 deletions packages/composer-admin/test/adminconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,17 +1091,6 @@ describe('AdminConnection', () => {
);
});
});

it('should not add card to card store if importIdentity fails', function() {
const cardName = 'conga';
const certificate = 'CERTIFICATE_DATA';
const privateKey = 'PRIVATE_KEY_DATA';
userCard.setCredentials({certificate : certificate, privateKey : privateKey});
mockConnectionManager.importIdentity.rejects(new Error('importIdentity'));
return adminConnection.importCard(cardName, userCard).should.be.rejected.then(() => {
return cardStore.has(cardName).should.become(false);
});
});
});

describe('#getAllCards', function () {
Expand Down

0 comments on commit 9e0f7f8

Please sign in to comment.