Skip to content

Commit

Permalink
fix(plugins): Return empty installed plugins list on any retrofit err…
Browse files Browse the repository at this point in the history
…or (#1424)
  • Loading branch information
jonsie authored Feb 16, 2021
1 parent 17fef48 commit 99362e3
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>> {
Expand Down Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 99362e3

Please sign in to comment.