From 16fa5c4b60546fe9c540cd1ed3adc1ecb0e59108 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Thu, 1 Aug 2024 15:13:57 -0500 Subject: [PATCH] fix(hg): add file branch for wsgi file (#430) * fix(hg): add branches for noble * fix(hg): add file branch for py3 --- salt/hg/files/hg/wsgi/python.wsgi | 5 ----- salt/hg/files/hg/wsgi/python3.wsgi | 6 ++++++ salt/hg/init.sls | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 salt/hg/files/hg/wsgi/python3.wsgi diff --git a/salt/hg/files/hg/wsgi/python.wsgi b/salt/hg/files/hg/wsgi/python.wsgi index 058bbaa1..b1eb056d 100644 --- a/salt/hg/files/hg/wsgi/python.wsgi +++ b/salt/hg/files/hg/wsgi/python.wsgi @@ -3,9 +3,4 @@ from mercurial import encoding CONFIG = '/srv/hg/repos.conf' encoding.encoding = 'utf-8' -{% if grains["oscodename"] == "noble" %} -application = hgwebdir(CONFIG.encode()) -{% else %} application = hgwebdir(CONFIG) -{% endif %} - diff --git a/salt/hg/files/hg/wsgi/python3.wsgi b/salt/hg/files/hg/wsgi/python3.wsgi new file mode 100644 index 00000000..5632caaf --- /dev/null +++ b/salt/hg/files/hg/wsgi/python3.wsgi @@ -0,0 +1,6 @@ +from mercurial.hgweb.hgwebdir_mod import hgwebdir +from mercurial import encoding + +CONFIG = '/srv/hg/repos.conf' +encoding.encoding = 'utf-8' +application = hgwebdir(CONFIG.encode()) diff --git a/salt/hg/init.sls b/salt/hg/init.sls index 369c7542..a4135a20 100644 --- a/salt/hg/init.sls +++ b/salt/hg/init.sls @@ -58,6 +58,26 @@ hg-user: - file_mode: "0755" - require: - user: hg-user + - exclude_pat: + - python*.wsgi + +{% if grains["oscodename"] == "noble" %} +/srv/hg/wsgi/python3.wsgi: + file.managed: + - source: salt://hg/files/hg/wsgi/python3.wsgi + - user: hg + - mode: "0755" + - require: + - file: /srv/hg/wsgi +{% else %} +/srv/hg/wsgi/python.wsgi: + file.managed: + - source: salt://hg/files/hg/wsgi/python.wsgi + - user: hg + - mode: "0755" + - require: + - file: /srv/hg/wsgi +{% endif %} /srv/hg/src: file.recurse: