diff options
| author | Avra Sengupta <asengupt@redhat.com> | 2015-04-09 14:24:43 +0530 | 
|---|---|---|
| committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-04-10 05:01:39 +0000 | 
| commit | 14dcabf21d308b69d0ec0a3ed910953f22e3aed8 (patch) | |
| tree | 24c6cc4293aeb1798f9f90e1a13e855ca7aa5a73 | |
| parent | 3f21a347932d741de24bccffb761689c5b368e7e (diff) | |
snapshot/scheduler: Fix deleting of snapshot schedule
Check if the argument has an attribute before
validating the attribute.
Change-Id: Ia4c6c91c2fca2ec3e82b47d81fbc19a5e0f17eb4
BUG: 1210204
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10168
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>
| -rwxr-xr-x | extras/snap_scheduler/snap_scheduler.py | 19 | 
1 files changed, 10 insertions, 9 deletions
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py index a20216d2492..fb3f446a4f1 100755 --- a/extras/snap_scheduler/snap_scheduler.py +++ b/extras/snap_scheduler/snap_scheduler.py @@ -372,16 +372,17 @@ def initialise_scheduler():  def syntax_checker(args):      ret = False -    if (len(args.jobname.split()) != 1): -        output("Invalid Jobname. Jobname should not be empty and should not contain \" \" character.") -        return ret - -    if (len(args.volname.split()) != 1): -        output("Invalid Volname. Volname should not be empty and should not contain \" \" character.") -        return ret +    if hasattr(args, 'jobname'): +        if (len(args.jobname.split()) != 1): +            output("Invalid Jobname. Jobname should not be empty and should not contain \" \" character.") +            return ret +        args.jobname=args.jobname.strip() -    args.jobname=args.jobname.strip() -    args.volname=args.volname.strip() +    if hasattr(args, 'volname'): +        if (len(args.volname.split()) != 1): +            output("Invalid Volname. Volname should not be empty and should not contain \" \" character.") +            return ret +        args.volname=args.volname.strip()      ret = True      return ret  | 
