diff --git a/cli/config.py b/cli/config.py index 12b15dbb..c732377c 100644 --- a/cli/config.py +++ b/cli/config.py @@ -124,7 +124,7 @@ def __parse_args(desc: str) -> object: def __normalize_json(json_data: dict[str, any], remove_empty: bool = True, remove_none: bool = True) -> dict[str, any]: """Sorts a JSON file and optionally remove empty and none values""" - SORT_FIELDS = {"users": "login"} + SORT_FIELDS = {"users": "login", "groups": "name"} log.info("Normalizing JSON - remove empty = %s, remove nones = %s", str(remove_empty), str(remove_none)) json_data = utilities.clean_data(json_data, remove_none=remove_none, remove_empty=remove_empty) json_data = utilities.order_keys(json_data, *_SECTIONS_ORDER) diff --git a/sonar/groups.py b/sonar/groups.py index c9586847..4d77aa31 100644 --- a/sonar/groups.py +++ b/sonar/groups.py @@ -345,11 +345,11 @@ def export(endpoint: pf.Platform, export_settings: types.ConfigSettings, **kwarg """ log.info("Exporting groups") - g_list = {} + g_list = [] for g_name, g_obj in get_list(endpoint=endpoint).items(): if not export_settings.get("FULL_EXPORT", False) and g_obj.is_default(): continue - g_list[g_name] = "" if g_obj.description is None else g_obj.description + g_list.append({"name": g_name, "description": g_obj.description or ""}) log.info("%s groups to export", len(g_list)) if write_q := kwargs.get("write_q", None): write_q.put(g_list)