diff --git a/pkg/api/types.go b/pkg/api/types.go index a9d15a3f47b..00b36868897 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -186,7 +186,7 @@ type Minion struct { // A list of minions. type MinionList struct { JSONBase `json:",inline" yaml:",inline"` - Minions []Minion `json:"minions,omitempty" yaml:"minions,omitempty"` + Items []Minion `json:"minions,omitempty" yaml:"minions,omitempty"` } // Status is a return value for calls that don't return other objects. diff --git a/pkg/cloudcfg/resource_printer.go b/pkg/cloudcfg/resource_printer.go index 6f2643cacc5..3718257b64d 100644 --- a/pkg/cloudcfg/resource_printer.go +++ b/pkg/cloudcfg/resource_printer.go @@ -64,6 +64,7 @@ type HumanReadablePrinter struct{} var podColumns = []string{"Name", "Image(s)", "Host", "Labels"} var replicationControllerColumns = []string{"Name", "Image(s)", "Selector", "Replicas"} var serviceColumns = []string{"Name", "Labels", "Selector", "Port"} +var minionColumns = []string{"Minion identifier"} var statusColumns = []string{"Status"} func (h *HumanReadablePrinter) unknown(data []byte, w io.Writer) error { @@ -135,6 +136,20 @@ func (h *HumanReadablePrinter) printServiceList(list *api.ServiceList, w io.Writ return nil } +func (h *HumanReadablePrinter) printMinion(minion *api.Minion, w io.Writer) error { + _, err := fmt.Fprintf(w, "%s\n", minion.ID) + return err +} + +func (h *HumanReadablePrinter) printMinionList(list *api.MinionList, w io.Writer) error { + for _, minion := range list.Items { + if err := h.printMinion(&minion, w); err != nil { + return err + } + } + return nil +} + func (h *HumanReadablePrinter) printStatus(status *api.Status, w io.Writer) error { err := h.printHeader(statusColumns, w) if err != nil { @@ -187,6 +202,12 @@ func (h *HumanReadablePrinter) Print(data []byte, output io.Writer) error { case *api.ServiceList: h.printHeader(serviceColumns, w) return h.printServiceList(o, w) + case *api.Minion: + h.printHeader(minionColumns, w) + return h.printMinion(o, w) + case *api.MinionList: + h.printHeader(minionColumns, w) + return h.printMinionList(o, w) case *api.Status: return h.printStatus(o, w) default: diff --git a/pkg/registry/minion_registry.go b/pkg/registry/minion_registry.go index 99e46674646..e5b6c0c131b 100644 --- a/pkg/registry/minion_registry.go +++ b/pkg/registry/minion_registry.go @@ -121,7 +121,7 @@ func (storage *MinionRegistryStorage) List(selector labels.Selector) (interface{ } var list api.MinionList for _, name := range nameList { - list.Minions = append(list.Minions, storage.toApiMinion(name)) + list.Items = append(list.Items, storage.toApiMinion(name)) } return list, nil } diff --git a/pkg/registry/minion_registry_test.go b/pkg/registry/minion_registry_test.go index a46936f2289..ca12a0be66b 100644 --- a/pkg/registry/minion_registry_test.go +++ b/pkg/registry/minion_registry_test.go @@ -101,7 +101,7 @@ func TestMinionRegistryStorage(t *testing.T) { JSONBase: api.JSONBase{ID: "foo"}, }, } - if !reflect.DeepEqual(list.(api.MinionList).Minions, expect) { + if !reflect.DeepEqual(list.(api.MinionList).Items, expect) { t.Errorf("Unexpected list value: %#v", list) } }