Merge pull request #15667 from JanetKuo/kubectl-watch-list

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-10-19 06:28:35 -07:00
4 changed files with 11 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
return err
}
if len(infos) != 1 {
return fmt.Errorf("watch is only supported on a single resource - %d resources were found", len(infos))
return fmt.Errorf("watch is only supported on individual resources and resource collections - %d resources were found", len(infos))
}
info := infos[0]
mapping := info.ResourceMapping()

View File

@@ -199,7 +199,7 @@ func (r *Result) Watch(resourceVersion string) (watch.Interface, error) {
return nil, err
}
if len(info) != 1 {
return nil, fmt.Errorf("watch is only supported on a single resource - %d resources were found", len(info))
return nil, fmt.Errorf("watch is only supported on individual resources and resource collections - %d resources were found", len(info))
}
return info[0].Watch(resourceVersion)
}

View File

@@ -564,6 +564,9 @@ func RetrieveLatest(info *Info, err error) error {
if err != nil {
return err
}
if runtime.IsListType(info.Object) {
return fmt.Errorf("watch is only supported on individual resources and resource collections, but a list of resources is found")
}
if len(info.Name) == 0 {
return nil
}