You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2020/11/02 21:28:00 UTC

[allura] 09/15: [#8378] keep ApacheAccessHandler.py for repos working on py2 for now

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 4734f445406101a2e37e2e56da331e15e6a30c51
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Oct 8 18:38:25 2020 -0400

    [#8378] keep ApacheAccessHandler.py for repos working on py2 for now
---
 scm_config/git-http/Dockerfile    | 4 ++++
 scm_config/git-http/git-http.conf | 4 ++--
 scripts/ApacheAccessHandler.py    | 5 ++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/scm_config/git-http/Dockerfile b/scm_config/git-http/Dockerfile
index f2da2d2..7fbfbaf 100644
--- a/scm_config/git-http/Dockerfile
+++ b/scm_config/git-http/Dockerfile
@@ -22,9 +22,13 @@
 # match main allura Dockerfile, for shared base
 FROM ubuntu:18.04
 
+# libapache2-mod-python is for py2 (both ubuntu:18.04 and ubuntu:20.04)
+# to match that, python-requests is also py2 on ubuntu:18.04 (probably python2-requests on ubuntu:20.04)
+# https://forge-allura.apache.org/p/allura/tickets/8352/ is to switch to mod_wsgi & py3 instead
 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
     apache2 \
     libapache2-mod-python \
+    python-requests \
     git \
     curl \
     sudo \
diff --git a/scm_config/git-http/git-http.conf b/scm_config/git-http/git-http.conf
index 7ac0acf..bee3882 100644
--- a/scm_config/git-http/git-http.conf
+++ b/scm_config/git-http/git-http.conf
@@ -52,8 +52,8 @@ ErrorLog /dev/stderr
         AuthBasicAuthoritative off
         PythonOption ALLURA_PERM_URL http://web:8088/auth/repo_permissions
         PythonOption ALLURA_AUTH_URL http://web:8088/auth/do_login
-        # for 'requests' lib only, doesn't have to be full allura venv
-        PythonOption ALLURA_VIRTUALENV /allura-data/virtualenv
+        # need python 'requests' lib only, doesn't have to be full allura venv
+        # PythonOption ALLURA_VIRTUALENV /some/venv/if/needed
     </Location>
 
     # declare what is being handled here
diff --git a/scripts/ApacheAccessHandler.py b/scripts/ApacheAccessHandler.py
index 4632541..afe928a 100644
--- a/scripts/ApacheAccessHandler.py
+++ b/scripts/ApacheAccessHandler.py
@@ -48,7 +48,10 @@ def load_requests_lib(req):
     virtualenv_path = req.get_options().get(str('ALLURA_VIRTUALENV'), None)
     if virtualenv_path:
         activate_this = '%s/bin/activate_this.py' % virtualenv_path
-        exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), {'__file__': activate_this})
+        try:
+            exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), {'__file__': activate_this})
+        except Exception as e:
+            log(req, "Couldn't activate venv via %s: %s" % (activate_this, repr(e)))
     global requests
     import requests as requests_lib
     requests = requests_lib