From 90106e917a0aa5ead77c18098067dcda26953cc9 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 20 Nov 2020 15:07:53 +1100 Subject: [PATCH] etherpad: fix robots.txt Fix the path to robots.txt and ensure it exists with testinfra Change-Id: Iacf9db38ee61cb8f17f261b422c0f2ac1d0b5e45 --- playbooks/roles/etherpad/templates/etherpad.vhost.j2 | 4 ++-- testinfra/test_etherpad.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/etherpad/templates/etherpad.vhost.j2 b/playbooks/roles/etherpad/templates/etherpad.vhost.j2 index 55eb1ecf37..2150a8b544 100644 --- a/playbooks/roles/etherpad/templates/etherpad.vhost.j2 +++ b/playbooks/roles/etherpad/templates/etherpad.vhost.j2 @@ -57,9 +57,9 @@ RewriteCond %{HTTP_HOST} !{{ etherpad_vhost_name }} RewriteRule ^.*$ https://{{ etherpad_vhost_name }} [L,R=301] - # Server robots.txt directly so that it does not affect + # Serve robots.txt directly so that it does not affect # etherpad-lite installation. - RewriteRule ^/robots.txt$ /var/etherpad/robots.txt [L] + RewriteRule ^/robots.txt$ /var/etherpad/www/robots.txt [L] # Refuse external connections to the API through the proxy RewriteRule ^/api/ - [F,L] diff --git a/testinfra/test_etherpad.py b/testinfra/test_etherpad.py index b5c11af745..d95cacd8a4 100644 --- a/testinfra/test_etherpad.py +++ b/testinfra/test_etherpad.py @@ -18,4 +18,10 @@ testinfra_hosts = ['etherpad01.opendev.org'] def test_etherpad_listening(host): etherpad = host.socket("tcp://127.0.0.1:9001") - assert etherpad.is_listening \ No newline at end of file + assert etherpad.is_listening + +def test_etherpad_robots(host): + cmd = host.run('curl --insecure ' + '--resolve etherpad.opendev.org:443:127.0.0.1 ' + 'https://etherpad.opendev.org/robots.txt') + assert 'Disallow: /' in cmd.stdout