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: