From 745857aa25450eeaa981039cebd69377c2212ab4 Mon Sep 17 00:00:00 2001 From: Douglas Jacobsen Date: Tue, 29 Oct 2024 19:35:23 -0600 Subject: [PATCH] Fix formatting of managed software This commit fixes the formatting of the software dictionaries (packages and environments) when they are auto-generated using the `ramble workspace manage software` commands --- lib/ramble/ramble/workspace/workspace.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/ramble/ramble/workspace/workspace.py b/lib/ramble/ramble/workspace/workspace.py index 105c8d167..7250c55a8 100644 --- a/lib/ramble/ramble/workspace/workspace.py +++ b/lib/ramble/ramble/workspace/workspace.py @@ -872,6 +872,10 @@ def manage_environments( software_dict = self.get_software_dict().copy() environments = software_dict[namespace.environments] + # Ensure package dict is an syaml_dict, for formatting + if not environments: + software_dict[namespace.environments] = syaml.syaml_dict() + environments = software_dict[namespace.environments] if remove: if env_name in environments: @@ -940,6 +944,11 @@ def manage_packages( packages = software_dict[namespace.packages] + # Ensure package dict is an syaml_dict, for formatting + if not packages: + software_dict[namespace.packages] = syaml.syaml_dict() + packages = software_dict[namespace.packages] + if remove: if pkg_name in packages: del packages[pkg_name]