Commit 0949e083 authored by AdoHe's avatar AdoHe

fix kubectl rolling update empty file cause panic issue

parent 4d896cd3
...@@ -220,6 +220,9 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -220,6 +220,9 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
if len(list.Items) > 1 { if len(list.Items) > 1 {
return cmdutil.UsageError(cmd, "%s specifies multiple items", filename) return cmdutil.UsageError(cmd, "%s specifies multiple items", filename)
} }
if len(list.Items) == 0 {
return cmdutil.UsageError(cmd, "please make sure %s exists and is not empty", filename)
}
obj = list.Items[0] obj = list.Items[0]
} }
newRc, ok = obj.(*api.ReplicationController) newRc, ok = obj.(*api.ReplicationController)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment