From ed2b16aace821eefb0f6ecb5400d49a14fffeccf Mon Sep 17 00:00:00 2001
From: Rad Cirskis
Date: Fri, 6 Oct 2017 14:00:02 +1300
Subject: [PATCH 1/5] added sentry ...
---
.dockerignore | 9 ++++++++-
Dockerfile | 1 +
Dockerfile.dev | 13 +++++++------
Makefile | 2 +-
application.py | 6 ++----
authcontroller.py | 11 +++++++----
docker-compose.yml | 1 +
requirements.txt | 2 ++
templates/http500.html | 17 ++++++++++++++++-
views.py | 11 ++++++++++-
10 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/.dockerignore b/.dockerignore
index 3ea2cacf9..6ffcd0ee3 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,14 @@
+.*
*.db
tags
tags.tmp
backup*
masterdb
-pgdata
+pgdata*
venv
+orcid
+htmlcov
+archive
+tests
+swagger.json
+
diff --git a/Dockerfile b/Dockerfile
index 54d3d2cb2..be0dd6433 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -92,6 +92,7 @@ RUN yum -y update \
&& rm -rf __db* \
&& rpm --rebuilddb \
&& yum -y clean all \
+ && rm -rf /var/cache/yum \
&& rm -rf $HOME/.pip/cache \
&& rm -rf /var/cache/*/* /anaconda-post.log \
&& rm -f /swagger-codegen-cli.jar /orcid_swagger.json \
diff --git a/Dockerfile.dev b/Dockerfile.dev
index aa8efd357..4caa0da88 100644
--- a/Dockerfile.dev
+++ b/Dockerfile.dev
@@ -6,26 +6,27 @@ LABEL maintainer="The University of Auckland" \
COPY dev_requirements.txt /dev_requirements.txt
ADD https://github.com/zaproxy/zaproxy/releases/download/2.6.0/ZAP_2.6.0_Linux.tar.gz ZAP_Linux.tar.gz
-ADD http://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-1.8.0.141/OpenJDK-1.8.0.141-x86_64-bin.tar.xz OpenJDK.tar.gz.xz
+ADD http://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-1.8.0.141/OpenJDK-1.8.0.141-x86_64-bin.tar.xz OpenJDK.tar.xz
RUN yum -y update \
&& yum -y install install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm \
&& yum -y install \
- postgresql96 \
+ postgresql96 \
python36u-pip \
git \
- && tar -xzf ZAP_Linux.tar.gz -C /tmp \
- && tar -xf OpenJDK.tar.gz.xz -C /tmp \
- && pip3.6 install -U git+https://github.com/Royal-Society-of-New-Zealand/zap-cli \
+ && tar -xzf ZAP_Linux.tar.gz -C /tmp \
+ && tar -xf OpenJDK.tar.xz -C /tmp \
+ && pip3.6 install -U git+https://github.com/Royal-Society-of-New-Zealand/zap-cli \
&& pip3.6 install -U flake8_docstrings pytest-cov coveralls pyyaml \
&& pip3.6 install -U -r /dev_requirements.txt \
&& cd /var/lib/rpm \
&& rm -rf __db* \
&& rpm --rebuilddb \
&& yum -y clean all \
+ && rm -rf /var/cache/yum \
&& rm -rf $HOME/.pip/cache \
&& rm -rf ZAP_Linux.tar.gz \
- && rm -rf OpenJDK.tar.gz.xz \
+ && rm -rf OpenJDK.tar.xz \
&& rm -rf /var/cache/*/* /anaconda-post.log /dev_requirements.txt
diff --git a/Makefile b/Makefile
index 9ca2013f8..ca6fbc083 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
NAME = orcidhub/app
-VERSION = 0.16
+VERSION = 0.17
.PHONY: all build test tag_latest
diff --git a/application.py b/application.py
index 87eb20e90..ffa090be0 100644
--- a/application.py
+++ b/application.py
@@ -12,9 +12,7 @@
from config import * # noqa: F401, F403
from failover import PgDbWithFailover
-# from raven.contrib.flask import Sentry
-
-##from raven.contrib.flask import Sentry
+from raven.contrib.flask import Sentry
app = Flask(__name__)
app.config.from_object(__name__)
@@ -34,7 +32,7 @@
app, name="NZ ORCiD Hub", template_mode="bootstrap3", base_template="admin/master.html")
# https://sentry.io/orcid-hub/nz-orcid-hub-dev/getting-started/python-flask/
-# sentry = Sentry(app, dsn=SENTRY_DSN)
+sentry = Sentry(app, logging=True, level=logging.DEBUG if ENV=="dev" else logging.ERROR)
login_manager = flask_login.LoginManager()
login_manager.login_view = "login"
diff --git a/authcontroller.py b/authcontroller.py
index 93a7b6a11..f3b793dd2 100644
--- a/authcontroller.py
+++ b/authcontroller.py
@@ -19,7 +19,7 @@
from urllib.parse import quote, unquote, urlparse
import requests
-from flask import (abort, current_app, flash, redirect, render_template, request, session, url_for)
+from flask import (abort, current_app, flash, g, redirect, render_template, request, session, url_for)
from flask_login import current_user, login_required, login_user, logout_user
from flask_mail import Message
from oauthlib.oauth2 import rfc6749
@@ -27,7 +27,7 @@
from werkzeug.urls import iri_to_uri
import orcid_client
-from application import app, db, mail
+from application import app, db, mail, sentry
from config import (APP_DESCRIPTION, APP_NAME, APP_URL, AUTHORIZATION_BASE_URL, CRED_TYPE_PREMIUM,
EXTERNAL_SP, MEMBER_API_FORM_BASE_URL, NOTE_ORCID, ORCID_API_BASE,
ORCID_BASE_URL, ORCID_CLIENT_ID, ORCID_CLIENT_SECRET, SCOPE_ACTIVITIES_UPDATE,
@@ -761,9 +761,12 @@ def uoa_slo():
@app.errorhandler(500)
def internal_error(error):
"""Handle internal error."""
- app.logger.exception("Unhandle exception occured.")
trace = traceback.format_exc()
- return render_template("http500.html", error_message=str(error), trace=trace)
+ return render_template("http500.html",
+ trace=trace,
+ error_message=str(error),
+ event_id=g.sentry_event_id,
+ public_dsn=sentry.client.get_public_dsn("https"))
@app.route("/orcid/login/")
diff --git a/docker-compose.yml b/docker-compose.yml
index 382f9850a..427fca561 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,6 +33,7 @@ services:
- SECRET_KEY
- ORCID_CLIENT_ID
- ORCID_CLIENT_SECRET
+ - SENTRY_DSN
domainname: orcidhub.org.nz
hostname: app
ports:
diff --git a/requirements.txt b/requirements.txt
index b16337f1b..c1739831f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,3 +14,5 @@ wtf-peewee
pycountry
html2text
tablib
+raven
+raven[flask]
diff --git a/templates/http500.html b/templates/http500.html
index 7767bf0b0..743579352 100644
--- a/templates/http500.html
+++ b/templates/http500.html
@@ -6,11 +6,26 @@ Webservice currently unavailable Error:
{{error_message}}An unexpected condition was encountered.
Our service team has been dispatched to bring it back online.
- {% if trace %}
+ {% if config.ENV != "prod" and trace %}
{% endif %}
+ {% if event_id %}
+
+
+ {% endif %}
{% endblock %}
diff --git a/views.py b/views.py
index e93b61317..54c7ac9e4 100644
--- a/views.py
+++ b/views.py
@@ -17,7 +17,7 @@
import orcid_client
import utils
-from application import admin, app
+from application import admin, app, sentry
from config import ORCID_BASE_URL, SCOPE_ACTIVITIES_UPDATE, SCOPE_READ_LIMITED
from forms import (BitmapMultipleValueField, FileUploadForm, OrgRegistrationForm, PartialDateField,
RecordForm, UserInvitationForm)
@@ -34,6 +34,15 @@
HEADERS = {"Accept": "application/vnd.orcid+json", "Content-type": "application/vnd.orcid+json"}
+@app.route("/failure")
+def failure():
+ try:
+ 1 / 0
+ except ZeroDivisionError as ex:
+ sentry.captureException()
+ abort(500, ex)
+
+
@app.route("/favicon.ico")
def favicon():
"""Support for the "favicon" legacy: faveicon location in the root directory."""
From e88eb2fdd4ef1ed991b2d7f30c32f8be682eaf68 Mon Sep 17 00:00:00 2001
From: Rad Cirskis
Date: Fri, 6 Oct 2017 14:05:36 +1300
Subject: [PATCH 2/5] fixed backup vacuum-ing...
---
backup-db.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/backup-db.sh b/backup-db.sh
index 946a2c47e..5d04c5f59 100755
--- a/backup-db.sh
+++ b/backup-db.sh
@@ -4,6 +4,7 @@ TS_LABEL=$(date +%FT%s)
PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:$HOME/.local/bin:$HOME/bin:$PATH:/usr/local/bin
[ ! -f docker-compose.yml ] && cd $HOME
-docker-compose exec -T db psql -U postgres -c "VACUUM FULL ANALYZE; SELECT pg_start_backup('$TS_LABEL', false);"
+docker-compose exec -T db psql -U postgres -c "VACUUM FULL ANALYZE;"
+docker-compose exec -T db psql -U postgres -c "SELECT pg_start_backup('$TS_LABEL', false);"
tar cjf ./backup/$TS_LABEL.tar.bz2 ./pgdata ; mv ./backup/$TS_LABEL.tar.bz2 ./archive/
docker-compose exec -T db psql -U postgres -c "SELECT pg_stop_backup();"
From 191b9042ccb1229308ab4cbdc27d3392197c5222 Mon Sep 17 00:00:00 2001
From: Rad Cirskis
Date: Fri, 6 Oct 2017 14:07:17 +1300
Subject: [PATCH 3/5] fixed formatting...
---
application.py | 5 ++--
authcontroller.py | 69 +++++++++++++++++++++++++++--------------------
conftest.py | 5 ++--
test_main.py | 11 ++++----
test_utils.py | 15 +++++++----
test_views.py | 17 ++++++------
views.py | 14 +++++-----
7 files changed, 76 insertions(+), 60 deletions(-)
diff --git a/application.py b/application.py
index ffa090be0..e9af83c88 100644
--- a/application.py
+++ b/application.py
@@ -8,12 +8,11 @@
from flask_debugtoolbar import DebugToolbarExtension
from flask_mail import Mail
from playhouse import db_url
+from raven.contrib.flask import Sentry
from config import * # noqa: F401, F403
from failover import PgDbWithFailover
-from raven.contrib.flask import Sentry
-
app = Flask(__name__)
app.config.from_object(__name__)
@@ -32,7 +31,7 @@
app, name="NZ ORCiD Hub", template_mode="bootstrap3", base_template="admin/master.html")
# https://sentry.io/orcid-hub/nz-orcid-hub-dev/getting-started/python-flask/
-sentry = Sentry(app, logging=True, level=logging.DEBUG if ENV=="dev" else logging.ERROR)
+sentry = Sentry(app, logging=True, level=logging.DEBUG if ENV == "dev" else logging.ERROR)
login_manager = flask_login.LoginManager()
login_manager.login_view = "login"
diff --git a/authcontroller.py b/authcontroller.py
index f3b793dd2..0d5019828 100644
--- a/authcontroller.py
+++ b/authcontroller.py
@@ -19,7 +19,8 @@
from urllib.parse import quote, unquote, urlparse
import requests
-from flask import (abort, current_app, flash, g, redirect, render_template, request, session, url_for)
+from flask import (abort, current_app, flash, g, redirect, render_template, request, session,
+ url_for)
from flask_login import current_user, login_required, login_user, logout_user
from flask_mail import Message
from oauthlib.oauth2 import rfc6749
@@ -91,9 +92,11 @@ def about():
else:
login_url = url_for("handle_login", _next=_next)
- org_onboarded_info = {r.name: r.tuakiri_name for r in
- Organisation.select(Organisation.name, Organisation.tuakiri_name).where(
- Organisation.confirmed.__eq__(True))}
+ org_onboarded_info = {
+ r.name: r.tuakiri_name
+ for r in Organisation.select(Organisation.name, Organisation.tuakiri_name).where(
+ Organisation.confirmed.__eq__(True))
+ }
return render_template(
"about.html",
@@ -114,9 +117,11 @@ def faq():
else:
login_url = url_for("handle_login", _next=_next)
- org_onboarded_info = {r.name: r.tuakiri_name for r in
- Organisation.select(Organisation.name, Organisation.tuakiri_name).where(
- Organisation.confirmed.__eq__(True))}
+ org_onboarded_info = {
+ r.name: r.tuakiri_name
+ for r in Organisation.select(Organisation.name, Organisation.tuakiri_name).where(
+ Organisation.confirmed.__eq__(True))
+ }
return render_template(
"faq.html",
@@ -533,7 +538,8 @@ def orcid_callback():
f"The ORCID Hub was not able to automatically write an affiliation with "
f"{user.organisation}, as the nature of the affiliation with your "
f"organisation does not appear to include either Employment or Education.\n "
- f"Please contact your Organisation Administrator(s) if you believe this is an error.", "warning")
+ f"Please contact your Organisation Administrator(s) if you believe this is an error.",
+ "warning")
session['Should_not_logout_from_ORCID'] = True
return redirect(url_for("profile"))
@@ -762,11 +768,12 @@ def uoa_slo():
def internal_error(error):
"""Handle internal error."""
trace = traceback.format_exc()
- return render_template("http500.html",
- trace=trace,
- error_message=str(error),
- event_id=g.sentry_event_id,
- public_dsn=sentry.client.get_public_dsn("https"))
+ return render_template(
+ "http500.html",
+ trace=trace,
+ error_message=str(error),
+ event_id=g.sentry_event_id,
+ public_dsn=sentry.client.get_public_dsn("https"))
@app.route("/orcid/login/")
@@ -842,7 +849,8 @@ def orcid_login(invitation_token=None):
return redirect(orcid_authenticate_url)
except Exception as ex:
- flash("Something went wrong. Please contact orcid@royalsociety.org.nz for support!", "danger")
+ flash("Something went wrong. Please contact orcid@royalsociety.org.nz for support!",
+ "danger")
app.logger.exception("Failed to login via ORCID.")
return redirect(url_for("login"))
@@ -861,8 +869,9 @@ def orcid_login_callback(request):
error = request.args.get("error")
if error == "access_denied":
- flash("You have just denied access to the Hub knowing your ORCID iD; to log in please try again and authorise",
- "warning")
+ flash(
+ "You have just denied access to the Hub knowing your ORCID iD; to log in please try again and authorise",
+ "warning")
return redirect(url_for("login"))
try:
@@ -913,9 +922,11 @@ def orcid_login_callback(request):
except User.DoesNotExist:
if email is None:
- flash(f"The account with ORCID iD {orcid_id} is not known in the Hub. "
- f"Try again when you've linked your ORCID iD with an organistion through either "
- f"a Tuakiri-mediated log in, or from an organisation's email invitation", "warning")
+ flash(
+ f"The account with ORCID iD {orcid_id} is not known in the Hub. "
+ f"Try again when you've linked your ORCID iD with an organistion through either "
+ f"a Tuakiri-mediated log in, or from an organisation's email invitation",
+ "warning")
return redirect(url_for("login"))
user = User.get(email=email)
@@ -936,7 +947,8 @@ def orcid_login_callback(request):
except Organisation.DoesNotExist:
flash("Organisation '{org_name}' doesn't exist in the Hub!", "danger")
app.logger.error(
- f"User '{user}' attempted to affiliate with an organisation that's not known: {org_name}")
+ f"User '{user}' attempted to affiliate with an organisation that's not known: {org_name}"
+ )
return redirect(url_for("login"))
session['Should_not_logout_from_ORCID'] = True
@@ -959,10 +971,9 @@ def orcid_login_callback(request):
flash(
"Exception when calling MemberAPIV20Api->view_employments: %s\n" % message,
"danger")
- flash(
- f"The Hub cannot verify your email address from your ORCID record. "
- f"Please, change the access level for your organisation email address "
- f"'{email}' to 'trusted parties'.", "danger")
+ flash(f"The Hub cannot verify your email address from your ORCID record. "
+ f"Please, change the access level for your organisation email address "
+ f"'{email}' to 'trusted parties'.", "danger")
return redirect(url_for("login"))
data = json.loads(api_response.data)
if data and data.get("email") and any(
@@ -979,10 +990,9 @@ def orcid_login_callback(request):
return redirect(url_for('viewmembers.index_view'))
else:
logout_user()
- flash(
- f"The Hub cannot verify your email address from your ORCID record. "
- f"Please, change the access level for your "
- f"organisation email address '{email}' to 'trusted parties'.", "danger")
+ flash(f"The Hub cannot verify your email address from your ORCID record. "
+ f"Please, change the access level for your "
+ f"organisation email address '{email}' to 'trusted parties'.", "danger")
return redirect(url_for("login"))
elif not user_org.is_admin and invitation_token:
@@ -1057,7 +1067,8 @@ def orcid_login_callback(request):
flash("Missing token.", "danger")
return redirect(url_for("login"))
except Exception as ex:
- flash(f"Something went wrong contact orcid@royalsociety.org.nz support for issue: {ex}", "danger")
+ flash(f"Something went wrong contact orcid@royalsociety.org.nz support for issue: {ex}",
+ "danger")
app.logger.exception("Unhandled excetion occrured while handling ORCID call-back.")
return redirect(url_for("login"))
diff --git a/conftest.py b/conftest.py
index e19c4d537..00e35600b 100644
--- a/conftest.py
+++ b/conftest.py
@@ -36,8 +36,9 @@ def app():
_app.config['TESTING'] = True
with test_database(
- _db, (Organisation, User, UserOrg, OrcidToken, UserOrgAffiliation, OrgInfo, Task,
- AffiliationRecord, OrcidAuthorizeCall, OrcidApiCall, Url, UserInvitation, OrgInvitation),
+ _db,
+ (Organisation, User, UserOrg, OrcidToken, UserOrgAffiliation, OrgInfo, Task,
+ AffiliationRecord, OrcidAuthorizeCall, OrcidApiCall, Url, UserInvitation, OrgInvitation),
fail_silently=True): # noqa: F405
_app.db = _db
yield _app
diff --git a/test_main.py b/test_main.py
index b6ed29bac..5a88c7eb3 100644
--- a/test_main.py
+++ b/test_main.py
@@ -8,7 +8,7 @@
import login_provider
import utils
-from models import Organisation, Role, User, UserOrg, OrgInvitation, OrgInfo
+from models import Organisation, OrgInfo, OrgInvitation, Role, User, UserOrg
def test_index(client):
@@ -186,7 +186,8 @@ def test_tuakiri_login_with_org(client):
def test_tuakiri_login_by_techical_contact_organisation_not_onboarded(client):
"""Test logging attempt by technical contact when organisation is not onboarded."""
org = Organisation(name="Org112", tuakiri_name="Org112", confirmed=False, is_email_sent=True)
- u = User(email="user1113@test.test.net", confirmed=True, roles=Role.TECHNICAL, organisation=org)
+ u = User(
+ email="user1113@test.test.net", confirmed=True, roles=Role.TECHNICAL, organisation=org)
org.tech_contact = u
org.save()
@@ -296,10 +297,8 @@ def test_onboard_org(request_ctx):
organisation_id=1,
confirmed=True,
organisation=org)
- org_info = OrgInfo.get_or_create(id=121,
- name="THE ORGANISATION",
- tuakiri_name="THE ORGANISATION"
- )
+ org_info = OrgInfo.get_or_create(
+ id=121, name="THE ORGANISATION", tuakiri_name="THE ORGANISATION")
org_info = OrgInfo.get(id=121)
u = User.get(id=123)
second_user = User.get(id=124)
diff --git a/test_utils.py b/test_utils.py
index 70ea4f4a9..ac5bca980 100644
--- a/test_utils.py
+++ b/test_utils.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""Tests for util functions."""
-import utils
-
from flask_login import login_user
-from models import Role, User, Organisation, UserOrg
+
+import utils
+from models import Organisation, Role, User, UserOrg
def test_append_qs():
@@ -102,5 +102,10 @@ def test_send_user_initation(request_ctx):
last_name = "Test"
affiliation_types = {"staff"}
with request_ctx("/"):
- utils.send_user_initation(inviter=inviter, org=org, email=email, first_name=first_name, last_name=last_name,
- affiliation_types=affiliation_types)
+ utils.send_user_initation(
+ inviter=inviter,
+ org=org,
+ email=email,
+ first_name=first_name,
+ last_name=last_name,
+ affiliation_types=affiliation_types)
diff --git a/test_views.py b/test_views.py
index 067da880b..8dc565661 100644
--- a/test_views.py
+++ b/test_views.py
@@ -1,23 +1,22 @@
# -*- coding: utf-8 -*-
"""Tests for core functions."""
-import sys
import json
-from flask_login import login_user
+import sys
+import time
+from itertools import product
+from unittest.mock import MagicMock, patch
-import views
import pytest
-
-from config import ORCID_BASE_URL
-from unittest.mock import MagicMock, patch
+from flask_login import login_user
from peewee import SqliteDatabase
from playhouse.test_utils import test_database
+import orcid_client
+import views
+from config import ORCID_BASE_URL
from models import (AffiliationRecord, OrcidToken, Organisation, Role, Task, User, UserOrg,
UserOrgAffiliation)
-from itertools import product
-import time
-import orcid_client
fake_time = time.time()
diff --git a/views.py b/views.py
index 54c7ac9e4..70b20fdc2 100644
--- a/views.py
+++ b/views.py
@@ -36,6 +36,7 @@
@app.route("/failure")
def failure():
+ """TODO: remove afer demoing the error handling..."""
try:
1 / 0
except ZeroDivisionError as ex:
@@ -1017,19 +1018,20 @@ def invite_organisation():
flash("New Technical contact has been Invited Successfully! "
"An email has been sent to the Technical contact", "success")
app.logger.info(
- "For Organisation '%s' , New Technical Contact '%s' has been invited successfully." %
- (form.org_name.data, form.org_email.data))
+ "For Organisation '%s' , New Technical Contact '%s' has been invited successfully."
+ % (form.org_name.data, form.org_email.data))
else:
flash("New Organisation Admin has been Invited Successfully! "
"An email has been sent to the Organisation Admin", "success")
app.logger.info(
- "For Organisation '%s' , New Organisation Admin '%s' has been invited successfully." %
- (form.org_name.data, form.org_email.data))
+ "For Organisation '%s' , New Organisation Admin '%s' has been invited successfully."
+ % (form.org_name.data, form.org_email.data))
else:
flash("Organisation Invited Successfully! "
"An email has been sent to the organisation contact", "success")
- app.logger.info("Organisation '%s' successfully invited. Invitation sent to '%s'." %
- (form.org_name.data, form.org_email.data))
+ app.logger.info(
+ "Organisation '%s' successfully invited. Invitation sent to '%s'." %
+ (form.org_name.data, form.org_email.data))
except Exception as ex:
app.logger.exception(f"Failed to send registration invitation with {params}.")
flash(f"Failed to send registration invitation: {ex}.", "danger")
From 66ec3acefe106d3bd279a22e0d295c8e45b17d9a Mon Sep 17 00:00:00 2001
From: Rad Cirskis
Date: Fri, 6 Oct 2017 19:44:01 +1300
Subject: [PATCH 4/5] removed the demo handler...
---
application.py | 2 +-
views.py | 12 +-----------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/application.py b/application.py
index e9af83c88..8db3c6ccc 100644
--- a/application.py
+++ b/application.py
@@ -8,10 +8,10 @@
from flask_debugtoolbar import DebugToolbarExtension
from flask_mail import Mail
from playhouse import db_url
-from raven.contrib.flask import Sentry
from config import * # noqa: F401, F403
from failover import PgDbWithFailover
+from raven.contrib.flask import Sentry
app = Flask(__name__)
app.config.from_object(__name__)
diff --git a/views.py b/views.py
index 70b20fdc2..8777303c8 100644
--- a/views.py
+++ b/views.py
@@ -17,7 +17,7 @@
import orcid_client
import utils
-from application import admin, app, sentry
+from application import admin, app
from config import ORCID_BASE_URL, SCOPE_ACTIVITIES_UPDATE, SCOPE_READ_LIMITED
from forms import (BitmapMultipleValueField, FileUploadForm, OrgRegistrationForm, PartialDateField,
RecordForm, UserInvitationForm)
@@ -34,16 +34,6 @@
HEADERS = {"Accept": "application/vnd.orcid+json", "Content-type": "application/vnd.orcid+json"}
-@app.route("/failure")
-def failure():
- """TODO: remove afer demoing the error handling..."""
- try:
- 1 / 0
- except ZeroDivisionError as ex:
- sentry.captureException()
- abort(500, ex)
-
-
@app.route("/favicon.ico")
def favicon():
"""Support for the "favicon" legacy: faveicon location in the root directory."""
From 6a74f4a79c603f87d030ddc42823381aceb49bd3 Mon Sep 17 00:00:00 2001
From: Rad Cirskis
Date: Fri, 6 Oct 2017 19:47:17 +1300
Subject: [PATCH 5/5] disable zap untill it gets resolved ...
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index fc4668aa2..419500a2e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ script:
- docker-compose exec db psql -U postgres -c "SELECT 1" && echo "DB IS RUNNING"
- docker-compose exec db psql -U orcidhub -d orcidhub -c "SELECT 1" && echo "DB orcidhub IS RUNNING"
- docker-compose exec app curl -k -s https://localhost/pyinfo -o /dev/null && echo "WSGI is working..."
- - docker-compose exec app env PATH="/tmp/OpenJDK-1.8.0.141-x86_64-bin/bin":$PATH ZAP_PATH="/tmp/ZAP_2.6.0/" LANG=en_US.UTF-8 zap-cli --verbose --port 8099 --api-key 12345 quick-scan -s xss,sqli --self-contained -o '-config api.key=12345' --spider -r http://127.0.01:5000/
+ # - docker-compose exec app env PATH="/tmp/OpenJDK-1.8.0.141-x86_64-bin/bin":$PATH ZAP_PATH="/tmp/ZAP_2.6.0/" LANG=en_US.UTF-8 zap-cli --verbose --port 8099 --api-key 12345 quick-scan -s xss,sqli --self-contained -o '-config api.key=12345' --spider -r http://127.0.01:5000/
after_success:
- echo "*** Deploying from $(curl ipv4.icanhazip.com)"