@@ -124,7 +124,7 @@ def __parse_args(desc: str) -> object:
124124
125125def __normalize_json (json_data : dict [str , any ], remove_empty : bool = True , remove_none : bool = True ) -> dict [str , any ]:
126126 """Sorts a JSON file and optionally remove empty and none values"""
127- SORT_FIELDS = {"users" : "login" , "groups" : "name" , "qualityGates" : "name" , "qualityProfiles" : "language" }
127+ sort_fields = {"users" : "login" , "groups" : "name" , "qualityGates" : "name" , "qualityProfiles" : "language" }
128128 log .info ("Normalizing JSON - remove empty = %s, remove nones = %s" , str (remove_empty ), str (remove_none ))
129129 json_data = utilities .clean_data (json_data , remove_none = remove_none , remove_empty = remove_empty )
130130 json_data = utilities .order_keys (json_data , * _SECTIONS_ORDER )
@@ -192,12 +192,8 @@ def write_objects(queue: Queue[types.ObjectJsonRepr], fd: TextIO, object_type: s
192192 obj_json = __prep_json_for_write (obj_json , export_settings )
193193 key = "" if isinstance (obj_json , list ) else obj_json .get ("key" , obj_json .get ("login" , obj_json .get ("name" , "unknown" )))
194194 log .debug ("Writing %s key '%s'" , object_type [:- 1 ], key )
195- if object_type in objects_exported_as_lists :
195+ if object_type in objects_exported_as_lists or object_type in objects_exported_as_whole :
196196 print (f"{ prefix } { utilities .json_dump (obj_json )} " , end = "" , file = fd )
197- elif object_type in objects_exported_as_whole :
198- print (f"{ prefix } { utilities .json_dump (obj_json )} " , end = "" , file = fd )
199- elif object_type in ("applications" , "portfolios" , "users" ):
200- print (f'{ prefix } "{ key } ": { utilities .json_dump (obj_json )} ' , end = "" , file = fd )
201197 else :
202198 log .debug ("Writing %s" , object_type )
203199 print (f"{ prefix } { utilities .json_dump (obj_json )[2 :- 1 ]} " , end = "" , file = fd )
0 commit comments