@@ -106,32 +106,6 @@ def remove_project_version_structure(project_name, version_name):
106106 response = bd .session .delete (project ['_meta' ]['href' ])
107107 logging .info (f"Operation completed with { response } " )
108108
109- def remove_codelocations_recursively (version ):
110- components = bd .get_resource ('components' , version )
111- subprojects = [x for x in components if x ['componentType' ] == 'SUB_PROJECT' ]
112- logging .info (f"Found { len (subprojects )} subprojects" )
113- unmap_all_codelocations (version )
114- for subproject in subprojects :
115- subproject_name = subproject ['componentName' ]
116- subproject_version_name = subproject ['componentVersionName' ]
117- project = find_project_by_name (subproject_name )
118- if not project :
119- logging .info (f"Project { subproject_name } does not exist." )
120- return
121- subproject_version = find_project_version_by_name (project , subproject_version_name )
122- if not subproject_version :
123- logging .info (f"Project { subproject_name } with version { subversion_name } does not exist." )
124- return
125- remove_codelocations_recursively (subproject_version )
126-
127- def unmap_all_codelocations (version ):
128- codelocations = bd .get_resource ('codelocations' ,version )
129- for codelocation in codelocations :
130- logging .info (f"Unmapping codelocation { codelocation ['name' ]} " )
131- codelocation ['mappedProjectVersion' ] = ""
132- response = bd .session .put (codelocation ['_meta' ]['href' ], json = codelocation )
133- pprint (response )
134-
135109def find_project_by_name (project_name ):
136110 params = {
137111 'q' : [f"name:{ project_name } " ]
0 commit comments