Skip to content

Commit

Permalink
refactor(front50,clouddriver): replace RetrofitError with SpinnakerRe…
Browse files Browse the repository at this point in the history
…trofitErrorHandler in DockerRegistry and PluginMonitor for custom error handling in front50 and clouddriver (#1125)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Luthan95 and mergify[bot] authored Sep 14, 2023
1 parent 1c88412 commit fa7bfa8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions igor-web/igor-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ dependencies {
implementation "javax.inject:javax.inject:1"
implementation "javax.validation:validation-api"

implementation "io.spinnaker.kork:kork-retrofit"

runtimeOnly "io.spinnaker.kork:kork-runtime"

testImplementation "com.squareup.okhttp:mockwebserver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider
import com.netflix.spinnaker.igor.IgorConfigurationProperties
import com.netflix.spinnaker.igor.docker.model.DockerRegistryAccounts
import com.netflix.spinnaker.igor.docker.service.ClouddriverService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger
import groovy.transform.CompileStatic
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
Expand Down Expand Up @@ -55,6 +56,7 @@ class DockerRegistryConfig {
.setClient(new Ok3Client(clientProvider.getClient(new DefaultServiceEndpoint("clouddriver", address))))
.setLogLevel(retrofitLogLevel)
.setLog(new Slf4jRetrofitLogger(ClouddriverService))
.setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance())
.build()
.create(ClouddriverService)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.netflix.spinnaker.kork.discovery.DiscoveryStatusListener;
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService;
import com.netflix.spinnaker.kork.jedis.RedisClientDelegate;
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler;
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger;
import java.util.Optional;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down Expand Up @@ -65,6 +66,7 @@ public PluginReleaseService pluginReleaseService(
clientProvider.getClient(new DefaultServiceEndpoint("front50", address))))
.setLogLevel(retrofitLogLevel)
.setLog(new Slf4jRetrofitLogger(Front50Service.class))
.setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance())
.build()
.create(Front50Service.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package com.netflix.spinnaker.igor.docker.model

import com.netflix.spinnaker.igor.docker.service.ClouddriverService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.security.AuthenticatedRequest
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import retrofit.RetrofitError

@Slf4j
class DockerRegistryAccounts {
Expand All @@ -40,8 +40,8 @@ class DockerRegistryAccounts {
service.getAccountDetails(it)
}
}
} catch (RetrofitError e) {
log.error "Failed to get list of docker accounts", e
} catch (SpinnakerServerException e) {
log.error "Failed to get list of docker accounts", e
}
}
}

0 comments on commit fa7bfa8

Please sign in to comment.