Merge "Fix running daemon with --disable-sshd flag"
This commit is contained in:
@@ -57,6 +57,7 @@ import com.google.gerrit.server.schema.SchemaUpdater;
|
||||
import com.google.gerrit.server.schema.SchemaVersionCheck;
|
||||
import com.google.gerrit.server.schema.UpdateUI;
|
||||
import com.google.gerrit.server.ssh.NoSshModule;
|
||||
import com.google.gerrit.server.ssh.NoSshKeyCache;
|
||||
import com.google.gerrit.sshd.SshKeyCacheImpl;
|
||||
import com.google.gerrit.sshd.SshModule;
|
||||
import com.google.gerrit.sshd.commands.MasterCommandModule;
|
||||
@@ -316,7 +317,11 @@ public class Daemon extends SiteProgram {
|
||||
}
|
||||
});
|
||||
}
|
||||
modules.add(SshKeyCacheImpl.module());
|
||||
if (sshd) {
|
||||
modules.add(SshKeyCacheImpl.module());
|
||||
} else {
|
||||
modules.add(NoSshKeyCache.module());
|
||||
}
|
||||
if (!slave) {
|
||||
modules.add(new MasterNodeStartup());
|
||||
}
|
||||
|
@@ -16,8 +16,21 @@ package com.google.gerrit.server.ssh;
|
||||
|
||||
import com.google.gerrit.common.errors.InvalidSshKeyException;
|
||||
import com.google.gerrit.reviewdb.client.AccountSshKey;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
||||
public class NoSshKeyCache implements SshKeyCache {
|
||||
|
||||
public static Module module() {
|
||||
return new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(SshKeyCache.class).to(NoSshKeyCache.class);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class NoSshKeyCache implements SshKeyCache {
|
||||
@Override
|
||||
public void evict(String username) {
|
||||
}
|
||||
|
@@ -23,6 +23,5 @@ public class NoSshModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(SshInfo.class).to(NoSshInfo.class);
|
||||
bind(SshKeyCache.class).to(NoSshKeyCache.class);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user