diff --git a/CHANGES.txt b/CHANGES.txt index 792bdc6e..41bb0d48 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,10 @@ +1.3.1 + +Bug Fixes +- Fixed startup error for new Asgard installations that lack an existing Config.groovy file +- Fixed startup error for AWS accounts that don't yet have an asgard SWF domain + + 1.3 Features diff --git a/application.properties b/application.properties index e33e767b..28e170da 100644 --- a/application.properties +++ b/application.properties @@ -3,4 +3,4 @@ app.grails.version=2.2.4 app.name=asgard app.servlet.version=2.4 -app.version=1.3 +app.version=1.3.1 diff --git a/grails-app/conf/spring/resources.groovy b/grails-app/conf/spring/resources.groovy index 686fbdef..f0a317a7 100644 --- a/grails-app/conf/spring/resources.groovy +++ b/grails-app/conf/spring/resources.groovy @@ -48,6 +48,7 @@ beans = { deploymentActivitiesImpl(DeploymentActivitiesImpl) { it.autowire = "byName" + it.lazyInit = true } snsTaskFinishedListener(SnsTaskFinishedListener) { bean -> diff --git a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy index 1ed1ba71..27d08201 100644 --- a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy @@ -81,12 +81,12 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { * Set up relevant cache objects to begin retrieving data. */ void initializeCaches() { - caches.allWorkflowDomains.ensureSetUp({ retrieveDomains() }, { + caches.allWorkflowDomains.ensureSetUp({ retrieveDomainsAndEnsureDomainIsRegistered() }, { caches.allOpenWorkflowExecutions.ensureSetUp({ retrieveOpenWorkflowExecutions() }) caches.allClosedWorkflowExecutions.ensureSetUp({ retrieveClosedWorkflowExecutions() }) + caches.allWorkflowTypes.ensureSetUp({ retrieveWorkflowTypes() }) + caches.allActivityTypes.ensureSetUp({ retrieveActivityTypes() }) }) - caches.allWorkflowTypes.ensureSetUp({ retrieveWorkflowTypes() }) - caches.allActivityTypes.ensureSetUp({ retrieveActivityTypes() }) } // Activity types @@ -364,7 +364,12 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { // Workflow Domains - private List retrieveDomains() { + /** + * Gets all the SWF domains and registers the main domain we need if it's not already in the list. + * + * @return info objects for all the registered domains in the default region + */ + List retrieveDomainsAndEnsureDomainIsRegistered() { log.debug('Retrieve workflow domains') ListDomainsRequest request = new ListDomainsRequest(registrationStatus: 'REGISTERED') List domains = domainFetcher.retrieve(Region.defaultRegion(), request) diff --git a/grails-app/services/com/netflix/asgard/FlowService.groovy b/grails-app/services/com/netflix/asgard/FlowService.groovy index cfb5fdfe..b4d8ebbf 100644 --- a/grails-app/services/com/netflix/asgard/FlowService.groovy +++ b/grails-app/services/com/netflix/asgard/FlowService.groovy @@ -43,6 +43,7 @@ import org.springframework.beans.factory.InitializingBean class FlowService implements InitializingBean { def awsClientService + def awsSimpleWorkflowService def configService def idService DeploymentActivitiesImpl deploymentActivitiesImpl @@ -61,6 +62,11 @@ class FlowService implements InitializingBean { ] as Map) void afterPropertiesSet() { + + // Ensure that the domain has been registered before attempting to reference it with workers. This code runs + // before cache filling begins. + awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() + String domain = configService.simpleWorkflowDomain String taskList = configService.simpleWorkflowTaskList GlobalWorkflowAttributes.taskList = taskList diff --git a/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy b/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy index fb9fb7f9..5fe9c5b8 100644 --- a/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy +++ b/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy @@ -51,7 +51,7 @@ class AwsSimpleWorkflowServiceUnitSpec extends Specification { awsSimpleWorkflowService.simpleWorkflowClient = Mock(AmazonSimpleWorkflow) when: - List domains = awsSimpleWorkflowService.retrieveDomains() + List domains = awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() then: domains == [new DomainInfo(name: 'domain1')] @@ -69,7 +69,7 @@ class AwsSimpleWorkflowServiceUnitSpec extends Specification { awsSimpleWorkflowService.simpleWorkflowClient = Mock(AmazonSimpleWorkflow) when: - awsSimpleWorkflowService.retrieveDomains() + awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() then: 1 * awsSimpleWorkflowService.simpleWorkflowClient.registerDomain(_)