14
14
ENDPOINT = "https://registry.cilogon.org/registry/"
15
15
USER = "co_7.group_fixup"
16
16
OSG_CO_ID = 7
17
+ LDAP_PROV_ID = 6
17
18
18
19
GET = "GET"
19
20
PUT = "PUT"
31
32
-f passfile specify path to file to open and read PASS
32
33
-e ENDPOINT specify REST endpoint
33
34
(default = { ENDPOINT } )
35
+ -p LDAP_PROV_ID LDAP Provisioning Target ID (default = { LDAP_PROV_ID } )
34
36
-a show all UnixCluster autogroups, not just misnamed ones
35
37
-i COGroupId show fixup info for a specific CO Group
36
38
-x COGroupId run UnixCluster Group fixups for given CO Group Id
@@ -60,6 +62,7 @@ def usage(msg=None):
60
62
class Options :
61
63
endpoint = ENDPOINT
62
64
osg_co_id = OSG_CO_ID
65
+ prov_id = LDAP_PROV_ID
63
66
user = USER
64
67
authstr = None
65
68
fix_gid = None
@@ -271,6 +274,17 @@ def rename_co_group(gid, group, newname):
271
274
return call_api3 (PUT , "co_groups/%s.json" % gid , data )
272
275
273
276
277
+ def provision_group (gid ):
278
+ prov_id = options .prov_id
279
+ path = f"co_provisioning_targets/provision/{ prov_id } /cogroupid:{ gid } .json"
280
+ data = {
281
+ "RequestType" : "CoGroupProvisioning" ,
282
+ "Version" : "1.0" ,
283
+ "Synchronous" : True
284
+ }
285
+ return call_api3 (POST , path , data )
286
+
287
+
274
288
def fixup_unixcluster_group (gid ):
275
289
group = get_co_group (gid )
276
290
oldname = group ["Name" ]
@@ -284,6 +298,8 @@ def fixup_unixcluster_group(gid):
284
298
for id_ in ids_to_delete :
285
299
delete_identifier (id_ )
286
300
301
+ provision_group (gid )
302
+
287
303
# http errors raise exceptions, so at this point we apparently succeeded
288
304
print (":thumbsup:" )
289
305
return 0
@@ -300,7 +316,7 @@ def fixup_all_unixcluster_groups():
300
316
301
317
def parse_options (args ):
302
318
try :
303
- ops , args = getopt .getopt (args , 'u:c:d:f:e:x:i:ah' , ["fix-all" ])
319
+ ops , args = getopt .getopt (args , 'u:c:d:f:e:x:i:p: ah' , ["fix-all" ])
304
320
except getopt .GetoptError :
305
321
usage ()
306
322
@@ -319,6 +335,7 @@ def parse_options(args):
319
335
if op == '-e' : options .endpoint = arg
320
336
if op == '-x' : options .fix_gid = int (arg )
321
337
if op == '-i' : options .info_gid = int (arg )
338
+ if op == '-p' : options .prov_id = int (arg )
322
339
if op == '-a' : options .showall = True
323
340
324
341
if op == '--fix-all' : options .fix_all = True
0 commit comments