Skip to content

Commit

Permalink
Fix formatting of managed software
Browse files Browse the repository at this point in the history
This commit fixes the formatting of the software dictionaries (packages
and environments) when they are auto-generated using the
`ramble workspace manage software` commands
  • Loading branch information
douglasjacobsen committed Oct 30, 2024
1 parent a9d6616 commit 745857a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/ramble/ramble/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 745857a

Please sign in to comment.