mirror of https://github.com/apache/jclouds.git
JCLOUDS-105 - fixing a problem caused in cases where vm.isPasswordEnabled() is false and no keypair is specified.
This commit is contained in:
parent
46f25bc913
commit
95308de808
|
@ -222,10 +222,10 @@ public class CloudStackComputeServiceAdapter implements
|
||||||
VirtualMachine vm = blockUntilJobCompletesAndReturnResult.<VirtualMachine>apply(job);
|
VirtualMachine vm = blockUntilJobCompletesAndReturnResult.<VirtualMachine>apply(job);
|
||||||
logger.debug("--- virtualmachine: %s", vm);
|
logger.debug("--- virtualmachine: %s", vm);
|
||||||
LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder();
|
LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder();
|
||||||
if (!vm.isPasswordEnabled() || templateOptions.getKeyPair() != null) {
|
if (templateOptions.getKeyPair() != null) {
|
||||||
SshKeyPair keyPair = keyPairCache.getUnchecked(templateOptions.getKeyPair());
|
SshKeyPair keyPair = keyPairCache.getUnchecked(templateOptions.getKeyPair());
|
||||||
credentialsBuilder.privateKey(keyPair.getPrivateKey());
|
credentialsBuilder.privateKey(keyPair.getPrivateKey());
|
||||||
} else {
|
} else if (vm.isPasswordEnabled()) {
|
||||||
assert vm.getPassword() != null : vm;
|
assert vm.getPassword() != null : vm;
|
||||||
credentialsBuilder.password(vm.getPassword());
|
credentialsBuilder.password(vm.getPassword());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue