-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnapomatic.destroyVolume
executable file
·52 lines (43 loc) · 1.25 KB
/
snapomatic.destroyVolume
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
#! /usr/bin/python3
import sys
pythonversion=sys.version_info
if pythonversion[0] != 3 or pythonversion[1] < 6:
print("This script requires Python 3.6 or higher")
sys.exit(1)
import os
import getopt
sys.path.append(sys.path[0] + "/NTAPlib")
from destroyVolumes import destroyVolumes
import userio
snapomaticversion='dev'
validoptions={'target':'multistr',
'volume':'str',
'debug':'bool',
'restdebug':'bool'}
requiredoptions=['target']
usage="Version " + snapomaticversion + "\n" + \
" --target\n" + \
" (svm volume)\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)
debug=0
if not len(myopts.target) == 2:
userio.fail(usage)
else:
svm=myopts.target[0]
volume=myopts.target[1]
debug=0
if myopts.debug:
debug=debug+1
if myopts.restdebug:
debug=debug+2
destroy=destroyVolumes(svm,volume,debug=debug)
if not destroy.go():
userio.message(destroy.reason)
sys.exit(1)
else:
userio.message("Destroyed " + svm + ":" + volume)
sys.exit(0)