summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2015-10-19 08:48:50 +0200
committerDavid Ostrovsky <david.ostrovsky@gmail.com>2015-11-20 06:13:19 +0000
commitcf417107693f15e171159697d572495854a4352e (patch)
treed32f9c7056d16514b3b6b2341466af7030da163d
parent27542ceec5afb4053f56e7ac5bd8c5783263f34a (diff)
InitPlugins: Suggest to upgrade installed plugins per default
So we had again Gerrit outage for wrong default plugin installation option during gerrit upgrade from 2.10.4 to 2.10.7: [1]. The reason for that outage was wrong default option for plugin installation or upgrade in gerrit installer: Install plugin reviewnotes version v2.10.2-18-gc6c5e0b [y/N]? Gerrit administrator relies on the installer suggesting the right thing to do per default. And always confirms the default option suggested by Gerrit installer. In this specific case, the installer made it too easy to shoot the admin in the foot, because JGit version had API changes, by removing the function release() in favor of close(), and by not updating the plugin(s) installer left the Gerrit site in inherently broken state. Note, that Gerrit admin neither must necessarily know if libraries that are used by plugins had incompatible changes in Gerrit core or not, nor Gerrit admin is supposed to study the Git history of all related libraries before upgrading Gerrit site. It's always the right thing to do to upgrade the plugins. [1] http://paste.openstack.org/show/476639 Test plan: * The plugins suggested to be upgraded per default on site upgrade: Installing plugins. Install plugin replication version v2.11.4-29-gefa3c6a [Y/n]? version v2.11.4-29-gefa3c6a is already installed, overwrite it [Y/n]? Install plugin singleusergroup version v2.11.3-3-gf6df712 [Y/n]? version v2.11.3-3-gf6df712 is already installed, overwrite it [Y/n]? Install plugin download-commands version v2.11.3-11-g86eb557 [Y/n]? version v2.11.3-11-g86eb557 is already installed, overwrite it [Y/n]? Install plugin reviewnotes version v2.11.3-8-g26f38c4 [Y/n]? version v2.11.3-8-g26f38c4 is already installed, overwrite it [Y/n]? Install plugin commit-message-length-validator version v2.11-4-g8d295ed [Y/n]? version v2.11-4-g8d295ed is already installed, overwrite it [Y/n]? Change-Id: I5d7f83f050144fda9c084fff3f163c120c642077
-rw-r--r--gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitPlugins.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitPlugins.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitPlugins.java
index 72400a42b5..921f69e4f2 100644
--- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitPlugins.java
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitPlugins.java
@@ -111,17 +111,18 @@ public class InitPlugins implements InitStep {
String pluginName = plugin.name;
try {
final File tmpPlugin = plugin.pluginFile;
+ File p = new File(site.plugins_dir, plugin.name + ".jar");
+ boolean upgrade = p.exists();
- if (!(initFlags.installPlugins.contains(pluginName) || ui.yesno(false,
+ if (!(initFlags.installPlugins.contains(pluginName) || ui.yesno(upgrade,
"Install plugin %s version %s", pluginName, plugin.version))) {
tmpPlugin.delete();
continue;
}
- final File p = new File(site.plugins_dir, plugin.name + ".jar");
- if (p.exists()) {
+ if (upgrade) {
final String installedPluginVersion = getVersion(p);
- if (!ui.yesno(false,
+ if (!ui.yesno(upgrade,
"version %s is already installed, overwrite it",
installedPluginVersion)) {
tmpPlugin.delete();