@@ -425,27 +425,48 @@ func removeSchedule(_ io.Writer, c *config.Config, flags commandLineFlags, args
425
425
}
426
426
427
427
func statusSchedule (_ io.Writer , c * config.Config , flags commandLineFlags , args []string ) error {
428
+ if ! containsString (args , "--all" ) {
429
+ // simple case of displaying status for one profile
430
+ scheduler , profile , schedules , err := getScheduleJobs (c , flags )
431
+ if err != nil {
432
+ return err
433
+ }
434
+ if len (schedules ) == 0 {
435
+ clog .Warningf ("profile %s has no schedule" , flags .name )
436
+ return nil
437
+ }
438
+ return statusScheduleProfile (scheduler , profile , schedules , flags )
439
+ }
440
+
428
441
for _ , profileName := range selectProfiles (c , flags , args ) {
429
442
profileFlags := flagsForProfile (flags , profileName )
430
-
431
443
scheduler , profile , schedules , err := getScheduleJobs (c , profileFlags )
432
- if err == nil {
433
- err = requireScheduleJobs (schedules , profileFlags )
434
- }
435
444
if err != nil {
436
445
return err
437
446
}
438
-
439
- displayProfileDeprecationNotices (profile )
440
-
441
- err = statusJobs (scheduler , profileName , convertSchedules (schedules ))
447
+ // it's all fine if this profile has no schedule
448
+ if len (schedules ) == 0 {
449
+ continue
450
+ }
451
+ err = statusScheduleProfile (scheduler , profile , schedules , profileFlags )
442
452
if err != nil {
443
- return retryElevated (err , flags )
453
+ // display the error but keep going with the other profiles
454
+ clog .Error (err )
444
455
}
445
456
}
446
457
return nil
447
458
}
448
459
460
+ func statusScheduleProfile (scheduler string , profile * config.Profile , schedules []* config.ScheduleConfig , flags commandLineFlags ) error {
461
+ displayProfileDeprecationNotices (profile )
462
+
463
+ err := statusJobs (scheduler , flags .name , convertSchedules (schedules ))
464
+ if err != nil {
465
+ return retryElevated (err , flags )
466
+ }
467
+ return nil
468
+ }
469
+
449
470
func getScheduleJobs (c * config.Config , flags commandLineFlags ) (string , * config.Profile , []* config.ScheduleConfig , error ) {
450
471
global , err := c .GetGlobalSection ()
451
472
if err != nil {
0 commit comments