Skip to content

Commit

Permalink
Merge pull request #25 from convox/list-processes-constrained
Browse files Browse the repository at this point in the history
scope process names correctly. fixes convox/kernel#116
  • Loading branch information
ddollar committed Sep 16, 2015
2 parents b2be469 + 5ae4d91 commit cc7253c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion api/models/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func ListProcesses(app string) (Processes, error) {
return nil, err
}

system, err := GetSystem()

if err != nil {
return nil, err
}

req := &ecs.ListTasksInput{
Cluster: aws.String(os.Getenv("CLUSTER")),
}
Expand Down Expand Up @@ -73,10 +79,24 @@ func ListProcesses(app string) (Processes, error) {
}

for _, cd := range tres.TaskDefinition.ContainerDefinitions {
if !strings.HasPrefix(*tres.TaskDefinition.Family, app+"-") && *tres.TaskDefinition.Family != app {
family := *tres.TaskDefinition.Family

if len(tres.TaskDefinition.ContainerDefinitions) == 0 {
continue
}

// if this is the kernel the family name is the app name
// otherwise family should be app name + process name
if app == system.Name {
if family != app {
continue
}
} else {
if family != fmt.Sprintf("%s-%s", app, *tres.TaskDefinition.ContainerDefinitions[0].Name) {
continue
}
}

var cc *ecs.Container

for _, c := range task.Containers {
Expand Down

0 comments on commit cc7253c

Please sign in to comment.