From 3938bb9a16ca84143ef86229d9d29b86393348a5 Mon Sep 17 00:00:00 2001 From: Antoni Mur Date: Mon, 20 Jan 2025 09:57:48 +0200 Subject: [PATCH] Replace forward slash in cluster_name (#3247) --- patroni/ctl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patroni/ctl.py b/patroni/ctl.py index 2ce4b024..1513f5ef 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -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))