Skip to content

Commit fac6a8e

Browse files
Fixed: unnecessary regeneration of SSH keys in developer mode when they already existed.
1 parent 5f9e131 commit fac6a8e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/com/cloud/server/ConfigurationServerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,9 @@ public void updateKeyPairs() {
617617
// FIXME: take a global database lock here for safety.
618618
boolean onWindows = isOnWindows();
619619
if(!onWindows) {
620-
Script.runSimpleBashScript("if [ -f " + privkeyfile + " ]; then rm -f " + privkeyfile + "; fi; ssh-keygen -t ecdsa -m PEM -N '' -f " + privkeyfile + " -q 2>/dev/null || ssh-keygen -t ecdsa -N '' -f " + privkeyfile + " -q");
620+
if (!privkeyfile.exists() && !pubkeyfile.exists()) {
621+
Script.runSimpleBashScript("if [ -f " + privkeyfile + " ]; then rm -f " + privkeyfile + "; fi; ssh-keygen -t ecdsa -m PEM -N '' -f " + privkeyfile + " -q 2>/dev/null || ssh-keygen -t ecdsa -N '' -f " + privkeyfile + " -q");
622+
}
621623
}
622624

623625
final String privateKey;

0 commit comments

Comments
 (0)