Skip to content

Commit 6978619

Browse files
Fix provisioning a project that needed an osggid
Projects that needed an OSGGID identifier weren't being provisioned if a UNIX cluster group already existed. Added identifier updating after adding missing identifiers and moved adding identifiers to before checking what projects need UNIX cluster groups and provisioning.
1 parent 50925c9 commit 6978619

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

project_group_setup.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,6 @@ def get_projects_needing_provisioning(project_groups):
190190
return set()
191191

192192

193-
def get_projects_to_setup(project_groups):
194-
projects_to_setup = {
195-
"Need Identifiers": get_projects_needing_identifiers(project_groups),
196-
"Need Cluster Groups": get_projects_needing_cluster_groups(project_groups),
197-
"Need Provisioning": get_projects_needing_provisioning(project_groups),
198-
}
199-
return projects_to_setup
200-
201-
202193
def add_missing_group_identifier(project, id_type, value):
203194
# If the group doesn't already have an id of this type...
204195
if utils.identifier_from_list(project["ID_List"], id_type) is None:
@@ -208,8 +199,11 @@ def add_missing_group_identifier(project, id_type, value):
208199

209200
def assign_identifiers_to_project(project, id_dict):
210201
for k, v in id_dict.items():
211-
# Add an identifier of type k and value v to this group, if it dones't have them already
202+
# Add an identifier of type k and value v to this group, if it doesn't have them already
212203
add_missing_group_identifier(project, k, v)
204+
# Update the project object to incldue the new identifiers
205+
new_identifiers = utils.get_co_group_identifiers(project["Gid"], options.endpoint, options.authstr)["Identifiers"]
206+
project["ID_List"] = new_identifiers
213207

214208

215209
def assign_identifiers(project_list, highest_osggid):
@@ -244,11 +238,17 @@ def main(args):
244238
parse_options(args)
245239

246240
comanage_data = get_comanage_data()
247-
projects_to_setup = get_projects_to_setup(comanage_data["Projects"])
241+
projects = comanage_data["Projects"]
242+
highest_current_osggid = comanage_data["highest_osggid"]
243+
244+
projects_needing_identifiers = get_projects_needing_identifiers(projects)
245+
assign_identifiers(projects_needing_identifiers, highest_current_osggid)
246+
247+
projects_needing_cluster_groups = get_projects_needing_cluster_groups(projects)
248+
create_unix_cluster_groups(projects_needing_cluster_groups)
248249

249-
assign_identifiers(projects_to_setup["Need Identifiers"], comanage_data["highest_osggid"])
250-
create_unix_cluster_groups(projects_to_setup["Need Cluster Groups"])
251-
provision_groups(projects_to_setup["Need Provisioning"])
250+
projects_needing_provisioning = get_projects_needing_provisioning(projects)
251+
provision_groups(projects_needing_provisioning)
252252

253253

254254
if __name__ == "__main__":

0 commit comments

Comments
 (0)