From 10ed06a5a1ec396bb8fc7cc1fa8182d93bf7dbb5 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 9 Apr 2015 14:58:25 +0530 Subject: snapshot/scheduler: Validate the number of entries in schedule A valid schedule entry in snapshot schedule must have six elements and adhere to the following format * * * * * | | | | | | | | | +---- Day of the Week (range: 1-7, 1 standing for Monday) | | | +------ Month of the Year (range: 1-12) | | +-------- Day of the Month (range: 1-31) | +---------- Hour (range: 0-23) +------------ Minute (range: 0-59) Change-Id: Idf03a3c43a461295dd3e2026bbcd0420319dd0e0 BUG: 1209408 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/10169 Reviewed-by: Aravinda VK Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- extras/snap_scheduler/snap_scheduler.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'extras/snap_scheduler') diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py index fb3f446a4f1..d383bf23e12 100755 --- a/extras/snap_scheduler/snap_scheduler.py +++ b/extras/snap_scheduler/snap_scheduler.py @@ -384,6 +384,18 @@ def syntax_checker(args): return ret args.volname=args.volname.strip() + if hasattr(args, 'schedule'): + if (len(args.schedule.split()) != 5): + output("Invalid Schedule. Please refer to the following for adding a valid cron schedule") + print ("* * * * *") + print ("| | | | |") + print ("| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)") + print ("| | | +------ Month of the Year (range: 1-12)") + print ("| | +-------- Day of the Month (range: 1-31)") + print ("| +---------- Hour (range: 0-23)") + print ("+------------ Minute (range: 0-59)") + return ret + ret = True return ret -- cgit