Skip to content

Commit

Permalink
revert(edda): revert 48348b due to bean issue (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns authored Oct 19, 2018
1 parent d593312 commit efa00d6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.okhttp.SpinnakerRequestInterceptor
import com.netflix.spinnaker.swabbie.clouddriver.CloudDriverService
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
Expand All @@ -30,7 +29,6 @@ import retrofit.RestAdapter
import retrofit.client.Client
import retrofit.converter.JacksonConverter

@ConditionalOnExpression("!\${eddaEndpoints.enabled:false}")
@Configuration
@Import(RetrofitConfiguration::class)
open class ClouddriverConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ import com.netflix.spinnaker.swabbie.AccountProvider
import com.netflix.spinnaker.swabbie.InMemoryCache
import com.netflix.spinnaker.swabbie.model.Account
import com.netflix.spinnaker.swabbie.model.SpinnakerAccount
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.stereotype.Component

@ConditionalOnBean(CloudDriverService::class)
@Component
class ClouddriverAccountProvider(
private val accountCache: InMemoryCache<SpinnakerAccount>
) : AccountProvider {
override fun getAccounts(): Set<Account> = accountCache.get()
}

@ConditionalOnBean(CloudDriverService::class)
@Component
class ClouddriverAccountCache(
cloudDriverService: CloudDriverService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ open class InMemoryCache<out T : Cacheable>(

private val cache = AtomicReference<Set<T>>()

@Scheduled(fixedDelay = 15 * 60 * 1000L) //TODO: make configurable
@Scheduled(fixedDelay = 60 * 60 * 1000L) //TODO: make configurable
private fun refresh() {
try {
cache.set(source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@ package com.netflix.spinnaker.config

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.swabbie.AccountProvider
import com.netflix.spinnaker.swabbie.edda.EddaEndpointsService
import com.netflix.spinnaker.swabbie.edda.EddaService
import com.netflix.spinnaker.swabbie.model.Account
import com.netflix.spinnaker.swabbie.retrofit.SwabbieRetrofitConfiguration
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import retrofit.Endpoint
import retrofit.Endpoints
import retrofit.RequestInterceptor
import retrofit.RestAdapter
Expand Down Expand Up @@ -63,27 +59,6 @@ open class EddaConfiguration {
}
}.flatten()
}

@ConditionalOnExpression("\${eddaEndpoints.enabled:false}")
@Bean
open fun eddaEndpointsEndpoint(@Value("\${eddaEndpoints.baseUrl}") eddaEndpointsBaseUrl: String) : Endpoint {
return Endpoints.newFixedEndpoint(eddaEndpointsBaseUrl)!!
}

@ConditionalOnExpression("\${eddaEndpoints.enabled:false}")
@Bean
open fun eddaEndpointsService(eddaEndpointsEndpoint: Endpoint,
objectMapper: ObjectMapper,
retrofitClient: Client,
spinnakerRequestInterceptor: RequestInterceptor,
retrofitLogLevel: RestAdapter.LogLevel) = RestAdapter.Builder()
.setRequestInterceptor(spinnakerRequestInterceptor)
.setEndpoint(eddaEndpointsEndpoint)
.setClient(retrofitClient)
.setLogLevel(retrofitLogLevel)
.setConverter(JacksonConverter(objectMapper))
.build()
.create(EddaEndpointsService::class.java)
}

data class EddaApiClient(
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit efa00d6

Please sign in to comment.