Skip to content

Commit

Permalink
return api.DaemonSetList, instead of an array
Browse files Browse the repository at this point in the history
  • Loading branch information
mqliang committed Oct 15, 2015
1 parent 877bfa6 commit 45269be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/client/cache/listers.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ func (s *StoreToDaemonSetLister) Exists(ds *extensions.DaemonSet) (bool, error)

// List lists all daemon sets in the store.
// TODO: converge on the interface in pkg/client
func (s *StoreToDaemonSetLister) List() (dss []extensions.DaemonSet, err error) {
func (s *StoreToDaemonSetLister) List() (dss extensions.DaemonSetList, err error) {
for _, c := range s.Store.List() {
dss = append(dss, *(c.(*extensions.DaemonSet)))
dss.Items = append(dss.Items, *(c.(*extensions.DaemonSet)))
}
return dss, nil
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/client/cache/listers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ func TestStoreToDaemonSetLister(t *testing.T) {
{ObjectMeta: api.ObjectMeta{Name: "basic"}},
},
list: func() ([]extensions.DaemonSet, error) {
return lister.List()
list, err := lister.List()
return list.Items, err
},
outDaemonSetNames: sets.NewString("basic"),
},
Expand All @@ -183,7 +184,8 @@ func TestStoreToDaemonSetLister(t *testing.T) {
{ObjectMeta: api.ObjectMeta{Name: "complex2"}},
},
list: func() ([]extensions.DaemonSet, error) {
return lister.List()
list, err := lister.List()
return list.Items, err
},
outDaemonSetNames: sets.NewString("basic", "complex", "complex2"),
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ func (dsc *DaemonSetsController) enqueueAllDaemonSets() {
glog.Errorf("Error enqueueing daemon sets: %v", err)
return
}
for i := range ds {
dsc.enqueueDaemonSet(&ds[i])
for i := range ds.Items {
dsc.enqueueDaemonSet(&ds.Items[i])
}
}

Expand Down

0 comments on commit 45269be

Please sign in to comment.