-
Notifications
You must be signed in to change notification settings - Fork 1
/
snapomatic.splitClones
executable file
·56 lines (47 loc) · 1.52 KB
/
snapomatic.splitClones
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/python3
import sys
pythonversion=sys.version_info
if pythonversion[0] != 3 or pythonversion[1] < 6:
userio.message("This script requires Python 3.6 or higher")
sys.exit(1)
import os
import getopt
sys.path.append(sys.path[0] + "/NTAPlib")
from splitClones import splitClones
import userio
snapomaticversion='dev'
validoptions={'target':'multistr',
'synchronous':'bool',
'debug':'bool',
'restdebug':'bool'}
requiredoptions=['svm','volume']
usage="Version " + snapomaticversion + "\n" + \
" --target\n" + \
" (svm volume)\n\n" + \
" --synchronous\n" + \
" (wait for split to complete)\n\n" + \
" [--debug]\n" + \
" (show debug output)\n\n" + \
" [--restdebug]\n" + \
" (show REST API calls and responses)\n\n"
myopts=userio.validateoptions(sys.argv,validoptions,usage=usage,required=requiredoptions)
svm=myopts.target[0]
if not len(myopts.target) > 1:
userio.fail(usage)
else:
volumes=myopts.target[1:]
debug=0
if myopts.debug:
debug=debug+1
if myopts.restdebug:
debug=debug+2
split=splitClones(svm,volumes,synchronous=myopts.synchronous,debug=debug)
split.go()
for vol in split.success:
if myopts.synchronous:
userio.message("Split complete: " + vol)
else:
userio.message("Split initiated: " + vol)
for vol in split.failed:
userio.message("Split failed: " + vol + ", '" + split.failedreason[vol] + "'")
sys.exit(0)