31
31
-f passfile specify path to file to open and read PASS
32
32
-e ENDPOINT specify REST endpoint
33
33
(default = { ENDPOINT } )
34
+ -a show all UnixCluster autogroups, not just misnamed ones
35
+ -i COGroupId show fixup info for a specific CO Group
36
+ -x COGroupId run UnixCluster Group fixups for given CO Group Id
34
37
-h display this help text
35
38
39
+ Run without options to display misnamed UnixCluster autogroups.
40
+ Run with -a to include UnixCluster autogroups with fixed names, too.
41
+ Run with -i to display only a given CO Group.
42
+ Run with -x to fixup a given CO Group.
43
+
36
44
PASS for USER is taken from the first of:
37
45
1. -u USER:PASS
38
46
2. -d passfd (read from fd)
@@ -49,10 +57,13 @@ def usage(msg=None):
49
57
50
58
51
59
class Options :
52
- endpoint = ENDPOINT
60
+ endpoint = ENDPOINT
53
61
osg_co_id = OSG_CO_ID
54
62
user = USER
55
- authstr = None
63
+ authstr = None
64
+ fix_gid = None
65
+ info_gid = None
66
+ showall = False
56
67
57
68
58
69
options = Options ()
@@ -281,7 +292,7 @@ def fixup_unixcluster_group(gid):
281
292
282
293
def parse_options (args ):
283
294
try :
284
- ops , args = getopt .getopt (args , 'u:c:d:f:e:o:h ' )
295
+ ops , args = getopt .getopt (args , 'u:c:d:f:e:x:i:ah ' )
285
296
except getopt .GetoptError :
286
297
usage ()
287
298
@@ -298,22 +309,33 @@ def parse_options(args):
298
309
if op == '-d' : passfd = int (arg )
299
310
if op == '-f' : passfile = arg
300
311
if op == '-e' : options .endpoint = arg
312
+ if op == '-x' : options .fix_gid = int (arg )
313
+ if op == '-i' : options .info_gid = int (arg )
314
+ if op == '-a' : options .showall = True
301
315
302
316
user , passwd = getpw (options .user , passfd , passfile )
303
317
options .authstr = mkauthstr (user , passwd )
304
318
305
319
306
-
307
-
308
320
def main (args ):
309
321
parse_options (args )
310
322
323
+ if options .fix_gid :
324
+ return fixup_unixcluster_group (options .fix_gid )
325
+ elif options .showall :
326
+ show_all_unixcluster_groups ()
327
+ elif options .info_gid :
328
+ show_one_unixcluster_group (options .info_gid )
329
+ else :
330
+ show_misnamed_unixcluster_groups ()
331
+
332
+ return 0
311
333
312
334
313
335
if __name__ == "__main__" :
314
336
try :
315
- main (sys .argv [1 :])
316
- except urllib .error .HTTPError as e :
337
+ sys . exit ( main (sys .argv [1 :]) )
338
+ except ( RuntimeError , urllib .error .HTTPError ) as e :
317
339
print (e , file = sys .stderr )
318
340
sys .exit (1 )
319
341
0 commit comments