fixed issue where admin user wasn't applying on terremark instances

This commit is contained in:
Adrian Cole 2011-10-16 03:00:57 -07:00
parent 738c507b20
commit 781aa88e30
1 changed files with 9 additions and 10 deletions

View File

@ -64,9 +64,8 @@ public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
protected final ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap;
@Inject
protected VAppToNodeMetadata(TerremarkVCloudComputeClient computeClient,
Map<String, Credentials> credentialStore, Map<Status, NodeState> vAppStatusToNodeState,
HardwareForVCloudExpressVApp hardwareForVCloudExpressVApp,
protected VAppToNodeMetadata(TerremarkVCloudComputeClient computeClient, Map<String, Credentials> credentialStore,
Map<Status, NodeState> vAppStatusToNodeState, HardwareForVCloudExpressVApp hardwareForVCloudExpressVApp,
FindLocationForResource findLocationForResourceInVDC, @Memoized Supplier<Set<? extends Image>> images,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap) {
this.images = checkNotNull(images, "images");
@ -105,8 +104,9 @@ public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
builder.publicAddresses(computeClient.getPublicAddresses(from.getHref()));
builder.privateAddresses(computeClient.getPrivateAddresses(from.getHref()));
String group = parseGroupFromName(from.getName());
if (group != null) {
builder.group(group);
// node-specific credentials override those from cache based on group
if (group != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString())) {
installCredentialsFromCache(from.getHref(), URI.create(vdcLocation.getParent().getId()), group, builder);
} else {
builder.credentials(credentialStore.get("node#" + from.getHref().toASCIIString()));
@ -122,8 +122,7 @@ public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
credentialStore.put("node#" + nodeId, creds);
}
// this is going to need refactoring.. we really need a credential list in
// the store per
// node.
// the store per node.
String adminPasswordKey = "node#" + nodeId + "#adminPassword";
if (credentialStore.containsKey(adminPasswordKey)) {
builder.adminPassword(credentialStore.get(adminPasswordKey).credential);