-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_sequester.py
executable file
·44 lines (33 loc) · 1.06 KB
/
check_sequester.py
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
#!/usr/bin/env python3
import os
import sys
import re
import logging
import tempfile
from time import gmtime, strftime
from ridlib import *
#logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')
def Help_RID_Check_Sequester():
print("")
print(sys.argv[0] + " - Returns the current sequester status of a Rid")
print("")
print("USAGE: " + sys.argv[0] + " <Rid>")
print("")
sys.exit(1)
# If I'm running under pychecker, remove it from sys.argv so it will work normally
for i in sys.argv:
if re.search("pychecker", i):
sys.argv.remove(i)
logging.debug("len(sys.argv) = " + str(len(sys.argv)))
logging.debug("sys.argv = " + str(sys.argv))
if len(sys.argv) != 2:
Help_RID_Check_Sequester()
Rid = sys.argv[1]
# Make sure it's a valid rid
Dict_Rid_To_Dev = Generate_Rid_to_Dev_Dict()
if Rid not in Dict_Rid_To_Dev:
logging.error("Rid " + Rid + " does not appear to be a valid Rid on this depot.")
sys.exit(1)
# Then...
print(RID_Check_Sequester(Rid))