Issue 1:
Apache Airflow version: 1.10.10

Environment:

Cloud provider or hardware configuration: aws

OS (e.g. from /etc/os-release): ecs task

Kernel (e.g. uname -a): python 3.6 image

What happened:

Upgrading from 1.10.9 to 1.10.10 gave error when trying to access UI

Node: 8cec32b7a064
-------------------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.6/site-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_login/utils.py", line 258, in decorated_view
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/airflow/utils/db.py", line 74, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/airflow/www/views.py", line 2330, in index
auto_complete_data=auto_complete_data)
File "/usr/local/lib/python3.6/site-packages/airflow/www/views.py", line 389, in render
return super(AirflowViewMixin, self).render(template, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_admin/base.py", line 308, in render
return render_template(template, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/usr/local/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/usr/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/airflow/www/templates/airflow/dags.html", line 20, in top-level template code
{% extends "airflow/master.html" %}
File "/usr/local/lib/python3.6/site-packages/airflow/www/templates/airflow/master.html", line 20, in top-level template code
{% extends "admin/master.html" %}
File "/usr/local/lib/python3.6/site-packages/airflow/www/templates/admin/master.html", line 20, in top-level template code
{% extends 'admin/base.html' %}
File "/usr/local/lib/python3.6/site-packages/flask_admin/templates/bootstrap3/admin/base.html", line 38, in top-level template code
{% block page_body %}
File "/usr/local/lib/python3.6/site-packages/airflow/www/templates/admin/master.html", line 191, in block "page_body"
{% block body %}
File "/usr/local/lib/python3.6/site-packages/airflow/www/templates/airflow/dags.html", line 84, in block "body"
<a href="{{ url_for('airflow.'+ dag.get_default_view(), dag_id=dag.dag_id) }}" title="{{ dag.description[0:80] + '...' if dag.description|length > 80 else dag.description }}">
TypeError: object of type 'NoneType' has no len()

What you expected to happen:

See UI

How to reproduce it:

Upgrade airflow

airflow upgradedb

Issue 2:
Apache Airflow version: airflow 1.10.10

Environment:

OS (e.g. from /etc/os-release): Mac

What happened:

Ooops! throws exception File "/Users/muru/opensrc/py36/airflow_110/venv368/lib/python3.6/site-packages/airflow/www/templates/airflow/dags.html", line 84, in block "body" <a href="{{ url_for('airflow.'+ dag.get_default_view(), dag_id=dag.dag_id) }}" title="{{ dag.description[0:80] + '...' if dag.description|length > 80 else dag.description }}"> TypeError: object of type 'NoneType' has no len()

What you expected to happen:

Should able to load page without errors or exceptions.

The description column in dag table can be null. But in the dags.html, should check dag.decription is not null before perform length filter.

How to reproduce it:

migrate airflow 1.9.0 to 1.10.10

Perform airflow upgradedb

start airflow webserver

launch and open http://localhost:8080/

Anything else we need to know:

Line 84 in airflow/www/templates/airflow/dags.html file, replace the condition

if dag.description|length > 80 change to if dag.description and dag.description|length > 80

As a workaround, perform the following db update and open http://localhost:8080/

update dag set description=' ' where description is null;