Skip to content

Commit 26d9ca9

Browse files
authored
Merge pull request #9 from edquist/SOFTWARE-5187.provision-ldap
Provision group after other fixups (SOFTWARE-5187)
2 parents 93bd0ec + 122a9a9 commit 26d9ca9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

group_fixup.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ENDPOINT = "https://registry.cilogon.org/registry/"
1515
USER = "co_7.group_fixup"
1616
OSG_CO_ID = 7
17+
LDAP_PROV_ID = 6
1718

1819
GET = "GET"
1920
PUT = "PUT"
@@ -31,6 +32,7 @@
3132
-f passfile specify path to file to open and read PASS
3233
-e ENDPOINT specify REST endpoint
3334
(default = {ENDPOINT})
35+
-p LDAP_PROV_ID LDAP Provisioning Target ID (default = {LDAP_PROV_ID})
3436
-a show all UnixCluster autogroups, not just misnamed ones
3537
-i COGroupId show fixup info for a specific CO Group
3638
-x COGroupId run UnixCluster Group fixups for given CO Group Id
@@ -60,6 +62,7 @@ def usage(msg=None):
6062
class Options:
6163
endpoint = ENDPOINT
6264
osg_co_id = OSG_CO_ID
65+
prov_id = LDAP_PROV_ID
6366
user = USER
6467
authstr = None
6568
fix_gid = None
@@ -271,6 +274,17 @@ def rename_co_group(gid, group, newname):
271274
return call_api3(PUT, "co_groups/%s.json" % gid, data)
272275

273276

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+
274288
def fixup_unixcluster_group(gid):
275289
group = get_co_group(gid)
276290
oldname = group["Name"]
@@ -284,6 +298,8 @@ def fixup_unixcluster_group(gid):
284298
for id_ in ids_to_delete:
285299
delete_identifier(id_)
286300

301+
provision_group(gid)
302+
287303
# http errors raise exceptions, so at this point we apparently succeeded
288304
print(":thumbsup:")
289305
return 0
@@ -300,7 +316,7 @@ def fixup_all_unixcluster_groups():
300316

301317
def parse_options(args):
302318
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"])
304320
except getopt.GetoptError:
305321
usage()
306322

@@ -319,6 +335,7 @@ def parse_options(args):
319335
if op == '-e': options.endpoint = arg
320336
if op == '-x': options.fix_gid = int(arg)
321337
if op == '-i': options.info_gid = int(arg)
338+
if op == '-p': options.prov_id = int(arg)
322339
if op == '-a': options.showall = True
323340

324341
if op == '--fix-all': options.fix_all = True

0 commit comments

Comments
 (0)