Skip to content

Commit

Permalink
Merge pull request #686 from douglasjacobsen/force-write-ws-config
Browse files Browse the repository at this point in the history
Allow force writing workspace config files
  • Loading branch information
douglasjacobsen authored Oct 5, 2024
2 parents 102281a + 119989c commit 4a5d93e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ramble/ramble/cmd/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def _workspace_create(
if config:
with open(config) as f:
workspace._read_config("workspace", f)
workspace._write_config("workspace")
workspace._write_config("workspace", force=True)

if template_execute:
with open(template_execute) as f:
Expand Down
4 changes: 2 additions & 2 deletions lib/ramble/ramble/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,14 @@ def write(self, software_dir=None, inputs_dir=None):

self._write_templates()

def _write_config(self, section):
def _write_config(self, section, force=False):
"""Update YAML config file for this workspace, based on
changes and write it"""
config = self.config_sections[section]

changed = not yaml_equivalent(config["raw_yaml"], config["yaml"])
written = os.path.exists(config["path"])
if changed or not written:
if changed or not written or force:
config["raw_yaml"] = copy.deepcopy(config["yaml"])
with fs.write_tmp_and_move(config["path"]) as f:
_write_yaml(config["yaml"], f, config["schema"])
Expand Down

0 comments on commit 4a5d93e

Please sign in to comment.