|
137 | 137 | */ |
138 | 138 | class InstallPluginCommand extends EnvironmentAwareCommand { |
139 | 139 |
|
140 | | - private static final String PROPERTY_STAGING_ID = "opensearch.plugins.staging"; |
141 | | - |
142 | 140 | // exit codes for install |
143 | 141 | /** A plugin with the same name is already installed. */ |
144 | 142 | static final int PLUGIN_EXISTS = 1; |
@@ -309,7 +307,6 @@ private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean i |
309 | 307 | if (OFFICIAL_PLUGINS.contains(pluginId)) { |
310 | 308 | final String url = getOpenSearchUrl( |
311 | 309 | terminal, |
312 | | - getStagingHash(), |
313 | 310 | Version.CURRENT, |
314 | 311 | isSnapshot(), |
315 | 312 | pluginId, |
@@ -341,38 +338,31 @@ private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean i |
341 | 338 | return downloadZip(terminal, pluginId, tmpDir, isBatch); |
342 | 339 | } |
343 | 340 |
|
344 | | - // pkg private so tests can override |
345 | | - String getStagingHash() { |
346 | | - return System.getProperty(PROPERTY_STAGING_ID); |
347 | | - } |
348 | | - |
349 | 341 | boolean isSnapshot() { |
350 | 342 | return Build.CURRENT.isSnapshot(); |
351 | 343 | } |
352 | 344 |
|
353 | 345 | /** Returns the url for an official opensearch plugin. */ |
354 | 346 | private String getOpenSearchUrl( |
355 | 347 | final Terminal terminal, |
356 | | - final String stagingHash, |
357 | 348 | final Version version, |
358 | 349 | final boolean isSnapshot, |
359 | 350 | final String pluginId, |
360 | 351 | final String platform |
361 | 352 | ) throws IOException, UserException { |
362 | 353 | final String baseUrl; |
363 | | - if (isSnapshot && stagingHash == null) { |
| 354 | + if (isSnapshot == false && version.isRelease() == false) { |
364 | 355 | throw new UserException( |
365 | 356 | ExitCodes.CONFIG, |
366 | 357 | "attempted to install release build of official plugin on snapshot build of OpenSearch" |
367 | 358 | ); |
368 | 359 | } |
369 | | - if (stagingHash != null) { |
| 360 | + if (isSnapshot == true) { |
370 | 361 | baseUrl = String.format( |
371 | 362 | Locale.ROOT, |
372 | | - "https://artifacts.opensearch.org/snapshots/plugins/%s/%s-%s", |
| 363 | + "https://artifacts.opensearch.org/snapshots/plugins/%s/%s", |
373 | 364 | pluginId, |
374 | | - version, |
375 | | - stagingHash |
| 365 | + version + "-SNAPSHOT" |
376 | 366 | ); |
377 | 367 | } else { |
378 | 368 | baseUrl = String.format( |
|
0 commit comments