Merge branch 'stable-2.12'

* stable-2.12:
  ChangeCleanupConfig: Allow canonical web URL to be null
  Daemon: Don't add change cleanup module when running as slave
  Daemon: Don't add index commands when running as slave

Change-Id: Iee663885e6db7c8def663f3ce2924a1c9f3f9e1b
This commit is contained in:
David Pursehouse
2015-12-03 17:57:20 +09:00
2 changed files with 12 additions and 5 deletions

View File

@@ -285,7 +285,9 @@ public class Daemon extends SiteProgram {
cfgInjector = createCfgInjector(); cfgInjector = createCfgInjector();
config = cfgInjector.getInstance( config = cfgInjector.getInstance(
Key.get(Config.class, GerritServerConfig.class)); Key.get(Config.class, GerritServerConfig.class));
initIndexType(); if (!slave) {
initIndexType();
}
sysInjector = createSysInjector(); sysInjector = createSysInjector();
sysInjector.getInstance(PluginGuiceEnvironment.class) sysInjector.getInstance(PluginGuiceEnvironment.class)
.setDbCfgInjector(dbInjector, cfgInjector); .setDbCfgInjector(dbInjector, cfgInjector);
@@ -383,7 +385,9 @@ public class Daemon extends SiteProgram {
} }
}); });
modules.add(new GarbageCollectionModule()); modules.add(new GarbageCollectionModule());
modules.add(new ChangeCleanupRunner.Module()); if (!slave) {
modules.add(new ChangeCleanupRunner.Module());
}
return cfgInjector.createChildInjector(modules); return cfgInjector.createChildInjector(modules);
} }
@@ -424,7 +428,7 @@ public class Daemon extends SiteProgram {
} }
modules.add(new DefaultCommandModule(slave, modules.add(new DefaultCommandModule(slave,
sysInjector.getInstance(DownloadConfig.class))); sysInjector.getInstance(DownloadConfig.class)));
if (indexType == IndexType.LUCENE) { if (!slave && indexType == IndexType.LUCENE) {
modules.add(new IndexCommandsModule()); modules.add(new IndexCommandsModule());
} }
return sysInjector.createChildInjector(modules); return sysInjector.createChildInjector(modules);

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.server.config; package com.google.gerrit.server.config;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.gerrit.common.Nullable;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Singleton; import com.google.inject.Singleton;
@@ -41,7 +42,7 @@ public class ChangeCleanupConfig {
@Inject @Inject
ChangeCleanupConfig(@GerritServerConfig Config cfg, ChangeCleanupConfig(@GerritServerConfig Config cfg,
@CanonicalWebUrl String canonicalWebUrl) { @CanonicalWebUrl @Nullable String canonicalWebUrl) {
scheduleConfig = new ScheduleConfig(cfg, SECTION); scheduleConfig = new ScheduleConfig(cfg, SECTION);
abandonAfter = readAbandonAfter(cfg); abandonAfter = readAbandonAfter(cfg);
abandonIfMergeable = abandonIfMergeable =
@@ -61,7 +62,9 @@ public class ChangeCleanupConfig {
if (Strings.isNullOrEmpty(abandonMessage)) { if (Strings.isNullOrEmpty(abandonMessage)) {
abandonMessage = DEFAULT_ABANDON_MESSAGE; abandonMessage = DEFAULT_ABANDON_MESSAGE;
} }
abandonMessage = abandonMessage.replaceAll("\\$\\{URL\\}", webUrl); if (!Strings.isNullOrEmpty(webUrl)) {
abandonMessage = abandonMessage.replaceAll("\\$\\{URL\\}", webUrl);
}
return abandonMessage; return abandonMessage;
} }