-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsequester_rid.py
More file actions
executable file
·45 lines (34 loc) · 1.1 KB
/
sequester_rid.py
File metadata and controls
executable file
·45 lines (34 loc) · 1.1 KB
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
#!/usr/bin/env python3
import os
import sys
import re
import logging
import tempfile
from time import gmtime, strftime
from ridlib import *
def Help_RID_Sequester():
print("")
print(sys.argv[0] + " - Sequesters a RID so it won't be mounted automatically by other scripts.")
print("")
print("USAGE: " + sys.argv[0] + " <Rid> \"<Comment>\"")
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.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')
logging.debug("len(sys.argv) = " + str(len(sys.argv)))
logging.debug("sys.argv = " + str(sys.argv))
if len(sys.argv) != 3:
Help_RID_Sequester()
Rid = sys.argv[1]
Msg = sys.argv[2]
# 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...
RID_Sequester(Rid, Msg)