From b5f481d9a40ace92504b0eadeee8b60c2947fa8f Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Tue, 14 Apr 2026 20:00:24 -0500 Subject: [PATCH] Fix qbt-config-patch for Python 3.14: use lambda in re.sub replacements Python 3.14 raises PatternError for backslash sequences like \P in re.sub replacement strings. Switch to lambda replacements which bypass that interpretation. Also pin to python:3.13-alpine to avoid future surprises from pulling :3-alpine. --- servers/legion/k8s/media/fornax-workers.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/servers/legion/k8s/media/fornax-workers.yaml b/servers/legion/k8s/media/fornax-workers.yaml index 102ac20..586d545 100644 --- a/servers/legion/k8s/media/fornax-workers.yaml +++ b/servers/legion/k8s/media/fornax-workers.yaml @@ -35,7 +35,7 @@ spec: securityContext: privileged: true - name: qbt-config-patch - image: python:3-alpine + image: python:3.13-alpine command: - python3 - -c @@ -51,10 +51,10 @@ spec: """Set key=value under [section], inserting if missing.""" key_pat = re.compile(r'^' + re.escape(key) + r'=.*', re.M) if key_pat.search(text): - return key_pat.sub(key + '=' + value, text) + return key_pat.sub(lambda m: key + '=' + value, text) sec_pat = re.compile(r'^\[' + re.escape(section) + r'\]', re.M) if sec_pat.search(text): - return sec_pat.sub('[' + section + ']\n' + key + '=' + value, text) + return sec_pat.sub(lambda m: '[' + section + ']\n' + key + '=' + value, text) return text + f'\n[{section}]\n{key}={value}\n' HASH = '@ByteArray(HqYj1eGsdXlQ4CSy597Y9A==:J9hsJIlU5FYfHb5rY5qQoIpVpTijryS/H+CE07oMtplL/ytneBVFd2tfVJtqGjhdht8tEi4wmqSSlqTgEu444w==)' @@ -241,7 +241,7 @@ spec: securityContext: privileged: true - name: qbt-config-patch - image: python:3-alpine + image: python:3.13-alpine command: - python3 - -c @@ -257,10 +257,10 @@ spec: """Set key=value under [section], inserting if missing.""" key_pat = re.compile(r'^' + re.escape(key) + r'=.*', re.M) if key_pat.search(text): - return key_pat.sub(key + '=' + value, text) + return key_pat.sub(lambda m: key + '=' + value, text) sec_pat = re.compile(r'^\[' + re.escape(section) + r'\]', re.M) if sec_pat.search(text): - return sec_pat.sub('[' + section + ']\n' + key + '=' + value, text) + return sec_pat.sub(lambda m: '[' + section + ']\n' + key + '=' + value, text) return text + f'\n[{section}]\n{key}={value}\n' HASH = '@ByteArray(HqYj1eGsdXlQ4CSy597Y9A==:J9hsJIlU5FYfHb5rY5qQoIpVpTijryS/H+CE07oMtplL/ytneBVFd2tfVJtqGjhdht8tEi4wmqSSlqTgEu444w==)'