Merge pull request #7221 from blackpiglet/schedule_cli_fix
Fix shedule get and describe CLI nil pointer issuepull/7225/head
commit
ee879fdcc3
|
@ -41,9 +41,8 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
|
|||
crClient, err := f.KubebuilderClient()
|
||||
cmd.CheckError(err)
|
||||
|
||||
var schedules *v1.ScheduleList
|
||||
schedules := new(v1.ScheduleList)
|
||||
if len(args) > 0 {
|
||||
schedules = new(v1.ScheduleList)
|
||||
for _, name := range args {
|
||||
schedule := new(v1.Schedule)
|
||||
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Namespace: f.Namespace(), Name: name}, schedule)
|
||||
|
|
|
@ -43,9 +43,8 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
|
|||
crClient, err := f.KubebuilderClient()
|
||||
cmd.CheckError(err)
|
||||
|
||||
var schedules *api.ScheduleList
|
||||
schedules := new(api.ScheduleList)
|
||||
if len(args) > 0 {
|
||||
schedules = new(api.ScheduleList)
|
||||
for _, name := range args {
|
||||
schedule := new(api.Schedule)
|
||||
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Name: name, Namespace: f.Namespace()}, schedule)
|
||||
|
|
Loading…
Reference in New Issue