@@ -123,7 +123,8 @@ def update_highest_osggid(highest_osggid, group):
123
123
124
124
125
125
def get_comanage_data ():
126
- comanage_data = {"Projects" : [], "highest_osggid" : 0 }
126
+ projects_list = []
127
+ highest_osggid = 0
127
128
128
129
co_groups = utils .get_osg_co_groups (options .osg_co_id , options .endpoint , options .authstr )["CoGroups" ]
129
130
for group_data in co_groups :
@@ -132,12 +133,14 @@ def get_comanage_data():
132
133
# Store this groups data in a dictionary to avoid repeated API calls
133
134
group = {"Gid" : group_data ["Id" ], "Name" : group_data ["Name" ], "ID_List" : identifier_list ["Identifiers" ]}
134
135
135
- append_if_project (comanage_data ["Projects" ], group )
136
+ # Add this group to the project list if it's a project, otherwise skip.
137
+ append_if_project (projects_list , group )
136
138
137
- comanage_data ["highest_osggid" ] = update_highest_osggid (comanage_data ["highest_osggid" ], group )
139
+ # Update highest_osggid, if this group has an osggid and it's higher than the current highest osggid.
140
+ highest_osggid = update_highest_osggid (highest_osggid , group )
138
141
except TypeError :
139
142
pass
140
- return comanage_data
143
+ return ( projects_list , highest_osggid )
141
144
142
145
143
146
def get_projects_needing_identifiers (project_groups ):
@@ -191,8 +194,9 @@ def get_projects_needing_provisioning(project_groups):
191
194
192
195
193
196
def add_missing_group_identifier (project , id_type , value ):
194
- # If the group doesn't already have an id of this type...
197
+ # If the group doesn't already have an id of this type ...
195
198
if utils .identifier_from_list (project ["ID_List" ], id_type ) is None :
199
+ # ... add the identifier to the group
196
200
utils .add_identifier_to_group (project ["Gid" ], id_type , value , options .endpoint , options .authstr )
197
201
print (f'project { project ["Gid" ]} : added id { value } of type { id_type } ' )
198
202
@@ -237,16 +241,23 @@ def provision_groups(project_list):
237
241
def main (args ):
238
242
parse_options (args )
239
243
240
- comanage_data = get_comanage_data ()
241
- projects = comanage_data ["Projects" ]
242
- highest_current_osggid = comanage_data ["highest_osggid" ]
244
+ # Make all of the nessisary calls to COManage's API for the data we'll need to set up projects.
245
+ # Projects is a List of dicts with keys Gid, Name, and Identifiers, the project's list of identifiers.
246
+ # Highest_current_osggid is the highest OSGGID that's currently assigned to any CO Group.
247
+ projects , highest_current_osggid = get_comanage_data ()
243
248
249
+ # From all the project groups in COManage, find the ones that need OSGGIDs or OSG GroupNames,
250
+ # then assign them the identifiers that they're missing.
244
251
projects_needing_identifiers = get_projects_needing_identifiers (projects )
245
252
assign_identifiers (projects_needing_identifiers , highest_current_osggid )
246
253
254
+ # From all the project groups in COManage, find the ones that don't have UNIX Cluster Groups,
255
+ # then create UNIX Cluster Groups for them.
247
256
projects_needing_cluster_groups = get_projects_needing_cluster_groups (projects )
248
257
create_unix_cluster_groups (projects_needing_cluster_groups )
249
258
259
+ # From all the project groups in COManage, find the ones that aren't already provisioned in LDAP,
260
+ # then have COManage provision the project/UNIX Cluster Group in LDAP.
250
261
projects_needing_provisioning = get_projects_needing_provisioning (projects )
251
262
provision_groups (projects_needing_provisioning )
252
263
0 commit comments