diff --git a/grails-app/controllers/com/netflix/asgard/ClusterController.groovy b/grails-app/controllers/com/netflix/asgard/ClusterController.groovy index da98a2e1..24306de4 100644 --- a/grails-app/controllers/com/netflix/asgard/ClusterController.groovy +++ b/grails-app/controllers/com/netflix/asgard/ClusterController.groovy @@ -394,6 +394,8 @@ ${lastGroup.loadBalancerNames}""" } final String nextGroupName = Relationships.buildNextAutoScalingGroupName(lastGroup.autoScalingGroupName) + if (params.nextAsgName && params.nextAsgName != nextGroupName) + throw new IllegalStateException("Asked for ${params.nextAsgName} but found ${nextGroupName}") List lastScalingPolicies = awsAutoScalingService.getScalingPolicyDatas(userContext, lastGroup.autoScalingGroupName) List newScalingPolicies = lastScalingPolicies.collect { ScalingPolicyData policy -> diff --git a/src/groovy/com/netflix/asgard/Relationships.groovy b/src/groovy/com/netflix/asgard/Relationships.groovy index 080b725b..d042573f 100644 --- a/src/groovy/com/netflix/asgard/Relationships.groovy +++ b/src/groovy/com/netflix/asgard/Relationships.groovy @@ -182,11 +182,7 @@ class Relationships { } static String buildNextAutoScalingGroupName(String previousGroupNameInCluster) { - Names names = dissectCompoundName(previousGroupNameInCluster) - Integer previous = names.sequence - Integer next = (previous == null || previous >= CLUSTER_MAX_SEQUENCE_NUMBER) ? 0 : previous + 1 - String threeDigitNextNumber = String.format("%03d", next) - "${names.cluster}-v${threeDigitNextNumber}" + return AutoScalingGroupNameBuilder.buildNextGroupName(previousGroupNameInCluster) } static String buildLoadBalancerName(String appName, String stack, String detail) {