Skip to content

Commit

Permalink
Merge pull request d2iq-archive#429 from mesosphere/no-null-enumerate
Browse files Browse the repository at this point in the history
Prevent /v1/enumerate from returning frameworks: null, or tasks: null
  • Loading branch information
sargun committed May 18, 2016
2 parents fa1e7ec + 9947747 commit 5dccfbb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions records/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ type EnumerationData struct {

// NewRecordGenerator returns a RecordGenerator that's been configured with a timeout.
func NewRecordGenerator(httpTimeout time.Duration) *RecordGenerator {
rg := &RecordGenerator{httpClient: http.Client{Timeout: httpTimeout}}
enumData := EnumerationData{
Frameworks: []*EnumerableFramework{},
}
rg := &RecordGenerator{
httpClient: http.Client{Timeout: httpTimeout},
EnumData: enumData,
}
return rg
}

Expand Down Expand Up @@ -436,7 +442,10 @@ func (rg *RecordGenerator) listenerRecord(listener string, ns string) {

func (rg *RecordGenerator) taskRecords(sj state.State, domain string, spec labels.Func, ipSources []string) {
for _, f := range sj.Frameworks {
enumerableFramework := &EnumerableFramework{Name: f.Name}
enumerableFramework := &EnumerableFramework{
Name: f.Name,
Tasks: []*EnumerableTask{},
}
rg.EnumData.Frameworks = append(rg.EnumData.Frameworks, enumerableFramework)

for _, task := range f.Tasks {
Expand Down

0 comments on commit 5dccfbb

Please sign in to comment.