Browse Source

Plugins: Changing staging property to be the hash instead of a boolean

With the unified release, we will have staged releases based on a
unified hash (hash of all the hashes), so using the elasticsearch hash
for plugins staging will no longer work. This change makes the
`es.plugins.staging` property take the staging hash it should use.
Ryan Ernst 9 years ago
parent
commit
478877edf7

+ 4 - 4
core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

@@ -25,7 +25,6 @@ import org.apache.lucene.util.IOUtils;
 import org.elasticsearch.Build;
 import org.elasticsearch.Version;
 import org.elasticsearch.bootstrap.JarHell;
-import org.elasticsearch.cli.Command;
 import org.elasticsearch.cli.ExitCodes;
 import org.elasticsearch.cli.SettingCommand;
 import org.elasticsearch.cli.Terminal;
@@ -101,7 +100,7 @@ import static org.elasticsearch.common.util.set.Sets.newHashSet;
  */
 class InstallPluginCommand extends SettingCommand {
 
-    private static final String PROPERTY_SUPPORT_STAGING_URLS = "es.plugins.staging";
+    private static final String PROPERTY_STAGING_ID = "es.plugins.staging";
 
     // TODO: make this a resource file generated by gradle
     static final Set<String> MODULES = unmodifiableSet(newHashSet(
@@ -209,12 +208,13 @@ class InstallPluginCommand extends SettingCommand {
         if (OFFICIAL_PLUGINS.contains(pluginId)) {
             final String version = Version.CURRENT.toString();
             final String url;
-            if (System.getProperty(PROPERTY_SUPPORT_STAGING_URLS, "false").equals("true")) {
+            final String stagingHash = System.getProperty(PROPERTY_STAGING_ID);
+            if (stagingHash != null) {
                 url = String.format(
                         Locale.ROOT,
                         "https://download.elastic.co/elasticsearch/staging/%1$s-%2$s/org/elasticsearch/plugin/%3$s/%1$s/%3$s-%1$s.zip",
                         version,
-                        Build.CURRENT.shortHash(),
+                        stagingHash,
                         pluginId);
             } else {
                 url = String.format(