3131
3232from cli import options
3333from sonar import exceptions , errcodes , utilities
34+ from sonar .util import types
3435import sonar .logging as log
3536from sonar import platform , rules , qualityprofiles , qualitygates , users , groups
3637from sonar import projects , portfolios , applications
@@ -220,7 +221,7 @@ def __export_config_sync(endpoint: platform.Platform, what: list[str], **kwargs)
220221 log .info ("Synchronous export of configuration from %s completed" , kwargs ["url" ])
221222
222223
223- def write_objects (queue : Queue , fd , object_type : str ) -> None :
224+ def write_objects (queue : Queue , fd , object_type : str , export_settings : types . ConfigSettings ) -> None :
224225 """
225226 Thread to write projects in the JSON file
226227 """
@@ -232,6 +233,8 @@ def write_objects(queue: Queue, fd, object_type: str) -> None:
232233 obj_json = queue .get ()
233234 done = obj_json is None
234235 if not done :
236+ if export_settings .get ("INLINE_LISTS" , True ):
237+ obj_json = utilities .inline_lists (obj_json , exceptions = ("conditions" ,))
235238 if object_type in ("projects" , "applications" , "portfolios" , "users" ):
236239 if object_type == "users" :
237240 key = obj_json .pop ("login" , None )
@@ -252,7 +255,7 @@ def __export_config_async(endpoint: platform.Platform, what: list[str], **kwargs
252255 """Exports a platform configuration in a JSON file"""
253256 file = kwargs [options .REPORT_FILE ]
254257 export_settings = {
255- "INLINE_LISTS" : False ,
258+ "INLINE_LISTS" : not kwargs [ "dontInlineLists" ] ,
256259 "EXPORT_DEFAULTS" : True ,
257260 # "FULL_EXPORT": kwargs["fullExport"],
258261 "FULL_EXPORT" : False ,
@@ -292,7 +295,7 @@ def __export_config_async(endpoint: platform.Platform, what: list[str], **kwargs
292295 if not is_first :
293296 print ("," , file = fd )
294297 is_first = False
295- worker = Thread (target = write_objects , args = (q , fd , ndx ))
298+ worker = Thread (target = write_objects , args = (q , fd , ndx , export_settings ))
296299 worker .daemon = True
297300 worker .name = f"Write{ ndx [:1 ].upper ()} { ndx [1 :10 ]} "
298301 worker .start ()
@@ -301,8 +304,6 @@ def __export_config_async(endpoint: platform.Platform, what: list[str], **kwargs
301304 except exceptions .UnsupportedOperation as e :
302305 log .warning (e .message )
303306 sq_settings = utilities .remove_empties (sq_settings )
304- # if not kwargs.get("dontInlineLists", False):
305- # sq_settings = utilities.inline_lists(sq_settings, exceptions=("conditions",))
306307 print ("\n }" , file = fd )
307308 log .info ("Exporting migration data from %s completed" , kwargs ["url" ])
308309
0 commit comments