def validate(args):
    ' validate arguments '
    if (args.external is not None):
        if (args.type and (args.type != 'External')):
            print("'--external' option is used only with '--type External'", file=sys.stderr)
            sys.exit(1)
        if (':' not in args.external):
            print('Invalid external storage details. Please specify details in the format <node>:/<volname>', file=sys.stderr)
            sys.exit(1)
        args.type = 'External'
    if args.tiebreaker:
        if (args.type != 'Replica2'):
            print("'--tiebreaker' option should be used only with type 'Replica2'", file=sys.stderr)
            sys.exit(1)
        if (':' not in args.tiebreaker):
            print('Invalid tiebreaker details. Please specify details in the format <node>:/<path>', file=sys.stderr)
            sys.exit(1)
    else:
        args.tiebreaker = 'tie-breaker.kadalu.io:/mnt'
    if (not args.type):
        args.type = 'Replica1'
    num_storages = (((len(args.device) + len(args.path)) + len(args.pvc)) or (1 if (args.external is not None) else 0))
    if (num_storages == 0):
        print('Please specify at least one storage', file=sys.stderr)
        sys.exit(1)
    if (((args.type == 'Replica1') and (num_storages != 1)) or ((args.type == 'Replica2') and (num_storages != 2)) or ((args.type == 'Replica3') and (num_storages != 3))):
        print(('Number of storages not matching for type=%s' % args.type), file=sys.stderr)
        sys.exit(1)
    kube_nodes = get_kube_nodes(args)
    for dev in args.device:
        if (':' not in dev):
            print('Invalid storage device details. Please specify device details in the format <node>:<device>', file=sys.stderr)
            sys.exit(1)
        if ((not args.dry_run) and (dev.split(':')[0] not in kube_nodes)):
            print(('Node name does not appear to be valid: ' + dev))
            sys.exit(1)
    for path in args.path:
        if (':' not in path):
            print('Invalid storage path details. Please specify path details in the format <node>:<path>', file=sys.stderr)
            sys.exit(1)
        if ((not args.dry_run) and (path.split(':')[0] not in kube_nodes)):
            print(('Node name does not appear to be valid: ' + path))
            sys.exit(1)
validate arguments
def validate(args):
    '  '
    if (args.external is not None):
        if (args.type and (args.type != 'External')):
            print("'--external' option is used only with '--type External'", file=sys.stderr)
            sys.exit(1)
        if (':' not in args.external):
            print('Invalid external storage details. Please specify details in the format <node>:/<volname>', file=sys.stderr)
            sys.exit(1)
        args.type = 'External'
    if args.tiebreaker:
        if (args.type != 'Replica2'):
            print("'--tiebreaker' option should be used only with type 'Replica2'", file=sys.stderr)
            sys.exit(1)
        if (':' not in args.tiebreaker):
            print('Invalid tiebreaker details. Please specify details in the format <node>:/<path>', file=sys.stderr)
            sys.exit(1)
    else:
        args.tiebreaker = 'tie-breaker.kadalu.io:/mnt'
    if (not args.type):
        args.type = 'Replica1'
    num_storages = (((len(args.device) + len(args.path)) + len(args.pvc)) or (1 if (args.external is not None) else 0))
    if (num_storages == 0):
        print('Please specify at least one storage', file=sys.stderr)
        sys.exit(1)
    if (((args.type == 'Replica1') and (num_storages != 1)) or ((args.type == 'Replica2') and (num_storages != 2)) or ((args.type == 'Replica3') and (num_storages != 3))):
        print(('Number of storages not matching for type=%s' % args.type), file=sys.stderr)
        sys.exit(1)
    kube_nodes = get_kube_nodes(args)
    for dev in args.device:
        if (':' not in dev):
            print('Invalid storage device details. Please specify device details in the format <node>:<device>', file=sys.stderr)
            sys.exit(1)
        if ((not args.dry_run) and (dev.split(':')[0] not in kube_nodes)):
            print(('Node name does not appear to be valid: ' + dev))
            sys.exit(1)
    for path in args.path:
        if (':' not in path):
            print('Invalid storage path details. Please specify path details in the format <node>:<path>', file=sys.stderr)
            sys.exit(1)
        if ((not args.dry_run) and (path.split(':')[0] not in kube_nodes)):
            print(('Node name does not appear to be valid: ' + path))
            sys.exit(1)