summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-04-09 14:58:25 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-04-10 05:03:11 +0000
commit10ed06a5a1ec396bb8fc7cc1fa8182d93bf7dbb5 (patch)
treeba22ae7a93b598b43e88f552abf9ee5f153887d5 /extras
parent14dcabf21d308b69d0ec0a3ed910953f22e3aed8 (diff)
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 <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/10169 Reviewed-by: Aravinda VK <avishwan@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'extras')
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py12
1 files changed, 12 insertions, 0 deletions
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