Skip to content

Commit

Permalink
fix(ecs): add application name filter to findCluster (#5168)
Browse files Browse the repository at this point in the history
(cherry picked from commit d43a0ea)
  • Loading branch information
piradeepk authored and mergify-bot committed Dec 21, 2020
1 parent 551cb92 commit f470f4b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.netflix.spinnaker.clouddriver.ecs.model.EcsServerGroup;
import com.netflix.spinnaker.clouddriver.ecs.model.EcsTask;
import com.netflix.spinnaker.clouddriver.ecs.model.TaskDefinition;
import com.netflix.spinnaker.clouddriver.ecs.names.MonikerHelper;
import com.netflix.spinnaker.clouddriver.ecs.security.NetflixECSCredentials;
import com.netflix.spinnaker.clouddriver.ecs.services.ContainerInformationService;
import com.netflix.spinnaker.clouddriver.ecs.services.SubnetSelector;
Expand Down Expand Up @@ -533,8 +534,9 @@ public ServerGroup getServerGroup(

try {
AmazonCredentials credentials = getEcsCredentials(account);
// Can't filter by application as there's not enough information in the serverGroupName
clusterMap = findClusters(clusterMap, credentials);
Moniker moniker = MonikerHelper.applicationNameToMoniker(serverGroupName);
log.debug("App Name is: " + moniker.getApp());
clusterMap = findClusters(clusterMap, credentials, moniker.getApp());
} catch (NoSuchElementException exception) {
/* This is ugly, but not sure how else to do it. If we don't have creds due
* to not being an ECS account, there's nothing to do here, and we should
Expand Down

0 comments on commit f470f4b

Please sign in to comment.