From 7df5a24b4affe44648d1cd758a4e3b5dbd70d9c0 Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@archlinux.org>
Date: Sat, 8 May 2021 23:29:41 +0200
Subject: [PATCH] Remove tubylaws deployment

The TU-Bylaws page is now deployed as gitlab page, making all of this
unrequired, the permanent redirect can stay for a while but the wiki is
already updated.
---
 roles/aurweb/defaults/main.yml         |  2 --
 roles/aurweb/tasks/main.yml            | 25 -------------------------
 roles/aurweb/templates/nginx.d.conf.j2 |  4 ++--
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/roles/aurweb/defaults/main.yml b/roles/aurweb/defaults/main.yml
index 020b6f9e1..70c342bf4 100644
--- a/roles/aurweb/defaults/main.yml
+++ b/roles/aurweb/defaults/main.yml
@@ -2,14 +2,12 @@
 
 aurweb_domain: 'aur.archlinux.org'
 aurweb_repository: 'https://gitlab.archlinux.org/archlinux/aurweb.git'
-tubylaws_repository: 'https://gitlab.archlinux.org/archlinux/tu-bylaws.git'
 aurweb_dir: '/srv/http/aurweb'
 aurweb_conf_dir: '/etc/aurweb'
 aurweb_git_dir: "{{ aurweb_dir }}/aur.git"
 aurweb_git_hook: '/usr/local/bin/aurweb-git-update'
 aurweb_nginx_conf: '/etc/nginx/nginx.d/aurweb.conf'
 aurweb_version: 'live'
-tubylaws_version: 'proposal-117'
 
 aurweb_db: 'aur'
 aurweb_db_host: 'localhost'
diff --git a/roles/aurweb/tasks/main.yml b/roles/aurweb/tasks/main.yml
index 7b930496c..47ce32dee 100644
--- a/roles/aurweb/tasks/main.yml
+++ b/roles/aurweb/tasks/main.yml
@@ -46,22 +46,12 @@
   become_user: "{{ aurweb_user }}"
   register: release
 
-- name: clone Trusted User documentation repo
-  git: >
-    repo={{ tubylaws_repository }}
-    dest="{{ aurweb_dir }}/tu-bylaws"
-    version={{ tubylaws_version }}
-  become: true
-  become_user: "{{ aurweb_user }}"
-  register: tubylaws_release
-
 - name: create necessary directories
   file: path={{ aurweb_dir }}/{{ item }} state=directory owner={{ aurweb_user }} group={{ aurweb_user }} mode=0755
   with_items:
     - 'aurblup'
     - 'sessions'
     - 'uploads'
-    - 'web/html/trusted-user'
 
 - name: create aurweb conf dir
   file: path={{ aurweb_conf_dir }} state=directory owner=root group=root mode=0755
@@ -128,21 +118,6 @@
   become: true
   become_user: "{{ aurweb_user }}"
 
-- name: Generate Trusted User documentation
-  make:
-    chdir: "{{ aurweb_dir }}/tu-bylaws"
-  become: true
-  become_user: "{{ aurweb_user }}"
-  when: tubylaws_release.changed
-
-- name: Install Trusted User documentation
-  copy: src={{ aurweb_dir }}/tu-bylaws/tu-bylaws.html dest={{ aurweb_dir }}/web/html/trusted-user/tu-bylaws.html remote_src=yes owner={{ aurweb_user }} group=http mode=0644
-  when: tubylaws_release.changed
-
-- name: Install Trusted User documentation symlink
-  file: src=tu-bylaws.html dest={{ aurweb_dir }}/web/html/trusted-user/TUbylaws.html state=link owner={{ aurweb_user }} group=http mode=0644
-  when: tubylaws_release.changed
-
 - name: set up nginx
   template: src=nginx.d.conf.j2 dest={{ aurweb_nginx_conf }} owner=root group=root mode=644
   notify: reload nginx
diff --git a/roles/aurweb/templates/nginx.d.conf.j2 b/roles/aurweb/templates/nginx.d.conf.j2
index f543ec789..5b5761235 100644
--- a/roles/aurweb/templates/nginx.d.conf.j2
+++ b/roles/aurweb/templates/nginx.d.conf.j2
@@ -42,8 +42,8 @@ server {
     root    {{ aurweb_dir }}/web/html;
     index   index.php;
 
-    location ~ ^/trusted-user/ {
-        break;
+    location = /trusted-user/TUbylaws.html {
+	    return 301 https://tu-bylaws.aur.archlinux.org;
     }
 
     location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
-- 
GitLab