Skip to content

Commit

Permalink
Replace forward slash in cluster_name (patroni#3247)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib32 authored Jan 20, 2025
1 parent 26ae389 commit 3938bb9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion patroni/ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2065,9 +2065,10 @@ def invoke_editor(before_editing: str, cluster_name: str) -> Tuple[str, Dict[str
if not editor_cmd:
raise PatroniCtlException('EDITOR environment variable is not set. editor or vi are not available')

safe_cluster_name = cluster_name.replace("/", "_")
with temporary_file(contents=before_editing.encode('utf-8'),
suffix='.yaml',
prefix='{0}-config-'.format(cluster_name)) as tmpfile:
prefix='{0}-config-'.format(safe_cluster_name)) as tmpfile:
ret = subprocess.call([editor_cmd, tmpfile])
if ret:
raise PatroniCtlException("Editor exited with return code {0}".format(ret))
Expand Down

0 comments on commit 3938bb9

Please sign in to comment.