Dan Davydov created AIRFLOW-940:
-----------------------------------

             Summary: Failing to unencrypt one variable shouldn't break the 
admin/variable page
                 Key: AIRFLOW-940
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-940
             Project: Apache Airflow
          Issue Type: Bug
          Components: webserver
            Reporter: Dan Davydov


At the moment failing to decrypt one of the airflow variables in the database 
using the fernet key will cause the admin/variable page to crash. Instead there 
should be an error message for only the broken variables at the top of the 
page, and the other ones should still be loaded and displayed.

This is what the trace on admin/variable currently looks like:
{code}
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in 
wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in 
full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in 
handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in 
full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in 
dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/base.py", line 68, 
in inner
    return self._run_view(f, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/base.py", line 367, 
in _run_view
    return fn(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/model/base.py", line 
1814, in index_view
    return_url=self._get_list_url(view_args),
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/base.py", line 307, 
in render
    return render_template(template, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 128, 
in render_template
    context, ctx.app)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 110, 
in _render
    rv = template.render(context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 
989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 
754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File 
"/usr/local/lib/python2.7/dist-packages/airflow/www/templates/airflow/variable_list.html",
 line 18, in top-level template code
    {% extends 'admin/model/list.html' %}
  File 
"/usr/local/lib/python2.7/dist-packages/flask_admin/templates/bootstrap3/admin/model/list.html",
 line 5, in top-level template code
    {% import 'admin/actions.html' as actionlib with context %}
  File 
"/usr/local/lib/python2.7/dist-packages/airflow/www/templates/admin/master.html",
 line 18, in top-level template code
    {% extends 'admin/base.html' %}
  File 
"/usr/local/lib/python2.7/dist-packages/flask_admin/templates/bootstrap3/admin/base.html",
 line 30, in top-level template code
    {% block page_body %}
  File 
"/usr/local/lib/python2.7/dist-packages/airflow/www/templates/admin/master.html",
 line 96, in block "page_body"
    {% block body %}
  File 
"/usr/local/lib/python2.7/dist-packages/flask_admin/templates/bootstrap3/admin/model/list.html",
 line 62, in block "body"
    {% block model_list_table %}
  File 
"/usr/local/lib/python2.7/dist-packages/flask_admin/templates/bootstrap3/admin/model/list.html",
 line 110, in block "model_list_table"
    {% block list_row scoped %}
  File 
"/usr/local/lib/python2.7/dist-packages/flask_admin/templates/bootstrap3/admin/model/list.html",
 line 165, in block "list_row"
    {{ get_value(row, c) }}
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/model/base.py", line 
1666, in get_list_value
    self.column_type_formatters,
  File "/usr/local/lib/python2.7/dist-packages/flask_admin/model/base.py", line 
1631, in _get_list_value
    value = column_fmt(self, context, model, name)
  File "/usr/local/lib/python2.7/dist-packages/airflow/www/views.py", line 
2146, in hidden_field_formatter
    return getattr(model, name)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", 
line 293, in __get__
    return self.descriptor.__get__(instance, owner)
  File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 3487, 
in get_val
    return FERNET.decrypt(bytes(self._val, 'utf-8')).decode()
  File "/usr/local/lib/python2.7/dist-packages/cryptography/fernet.py", line 
82, in decrypt
    raise InvalidToken
InvalidToken
{quote}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to