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