Skip to content

Commit f250bcf

Browse files
committed
Export groups as list
1 parent 81507af commit f250bcf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cli/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __parse_args(desc: str) -> object:
124124

125125
def __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"}
127+
SORT_FIELDS = {"users": "login", "groups": "name"}
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)

sonar/groups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ def export(endpoint: pf.Platform, export_settings: types.ConfigSettings, **kwarg
345345
"""
346346

347347
log.info("Exporting groups")
348-
g_list = {}
348+
g_list = []
349349
for g_name, g_obj in get_list(endpoint=endpoint).items():
350350
if not export_settings.get("FULL_EXPORT", False) and g_obj.is_default():
351351
continue
352-
g_list[g_name] = "" if g_obj.description is None else g_obj.description
352+
g_list.append({"name": g_name, "description": g_obj.description or ""})
353353
log.info("%s groups to export", len(g_list))
354354
if write_q := kwargs.get("write_q", None):
355355
write_q.put(g_list)

0 commit comments

Comments
 (0)