fix(plugins): Return empty installed plugins list on any retrofit error
MODIFY
gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt
gate-plugins/src/main/kotlin/com/netflix/spinnaker/gate/plugins/web/installed/PluginsInstalledController.kt
@@ -16,6 +16,7 @@ import com.netflix.spinnaker.kork.plugins.update.SpinnakerUpdateManager
import io.swagger.annotations.ApiOperation
import java.util.stream.Collectors
import org.pf4j.PluginWrapper
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.ObjectProvider
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
@@ -40,6 +41,8 @@ class PluginsInstalledController(
private val deckPluginService: DeckPluginService
) {
+ private val log by lazy { LoggerFactory.getLogger(javaClass) }
+
@ApiOperation(value = "Get all installed Spinnaker plugins")
@RequestMapping(method = [RequestMethod.GET])
fun getInstalledPlugins(@RequestParam(value = "service", required = false) service: String?): Map<String, List<SpinnakerPluginDescriptor>> {
@@ -120,11 +123,8 @@ class PluginsInstalledController(
return try {
call()
} catch (e: RetrofitError) {
- if (e.response?.status == 404) {
- emptyList()
- } else {
- throw e
- }
+ log.warn("Unable to retrieve installed plugins from '${e.response?.url}' due to '${e.response?.status}'")
+ return emptyList()
}
}

fix(plugins): Return empty installed plugins list on any retrofit error (#1424)