From bac2681f715303657b6aee0d8fd6e7582bd28f71 Mon Sep 17 00:00:00 2001 From: Joe Sondow Date: Thu, 24 Oct 2013 21:08:14 -0700 Subject: [PATCH] Ensure SWF domain gets created before attempting to reference the domain with live workers. --- CHANGES.txt | 6 ++++-- .../com/netflix/asgard/AwsSimpleWorkflowService.groovy | 7 ++++++- grails-app/services/com/netflix/asgard/FlowService.groovy | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f14b08a9..41bb0d48 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,9 @@ 1.3.1 -Bug Fix -- Fixed critical error for new Asgard installations that lack an existing Config.groovy file +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 diff --git a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy index 68123d60..27d08201 100644 --- a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy @@ -364,7 +364,12 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { // Workflow Domains - private List retrieveDomainsAndEnsureDomainIsRegistered() { + /** + * 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