Upgrades to Django 1.6

This commit is contained in:
Peter Baumgartner 2014-03-05 22:13:09 -06:00
parent eea4e8f2d0
commit b262371a53
17 changed files with 48 additions and 49 deletions

View File

@ -12,7 +12,7 @@ import logging
logger = logging.getLogger(__name__)
email_template = """Service {{ service.name }} {{ scheme }}://{{ host }}{% url service pk=service.id %} {% if service.overall_status != service.PASSING_STATUS %}alerting with status: {{ service.overall_status }}{% else %}is back to normal{% endif %}.
email_template = """Service {{ service.name }} {{ scheme }}://{{ host }}{% url 'service' pk=service.id %} {% if service.overall_status != service.PASSING_STATUS %}alerting with status: {{ service.overall_status }}{% else %}is back to normal{% endif %}.
{% if service.overall_status != service.PASSING_STATUS %}
CHECKS FAILING:{% for check in service.all_failing_checks %}
FAILING - {{ check.name }} - Type: {{ check.check_category }} - Importance: {{ check.get_importance_display }}{% endfor %}
@ -23,9 +23,9 @@ Passing checks:{% for check in service.all_passing_checks %}
{% endif %}
"""
hipchat_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url service pk=service.id %}. {% if service.overall_status != service.PASSING_STATUS %}Checks failing:{% for check in service.all_failing_checks %} {{ check.name }}{% if check.last_result.error %} ({{ check.last_result.error|safe }}){% endif %}{% endfor %}{% endif %}{% if alert %}{% for alias in users %} @{{ alias }}{% endfor %}{% endif %}"
hipchat_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url 'service' pk=service.id %}. {% if service.overall_status != service.PASSING_STATUS %}Checks failing:{% for check in service.all_failing_checks %} {{ check.name }}{% if check.last_result.error %} ({{ check.last_result.error|safe }}){% endif %}{% endfor %}{% endif %}{% if alert %}{% for alias in users %} @{{ alias }}{% endfor %}{% endif %}"
sms_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url service pk=service.id %}"
sms_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url 'service' pk=service.id %}"
telephone_template = "This is an urgent message from Arachnys monitoring. Service \"{{ service.name }}\" is erroring. Please check Cabot urgently."

View File

@ -3,7 +3,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError
from polymorphic import PolymorphicModel
from django.db.models import F
from django.contrib.admin.models import User
from django.contrib.auth.models import User
from .jenkins import get_job_status
from .alert import send_alert

View File

@ -1 +0,0 @@
from basic import *

View File

@ -32,7 +32,7 @@
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="{% url services %}" class="navbar-brand"><img src="{{ STATIC_URL }}arachnys/img/icon_48x48.png" width='20' height='20' /> Cabot by Arachnys</a>
<a href="{% url "services" %}" class="navbar-brand"><img src="{{ STATIC_URL }}arachnys/img/icon_48x48.png" width='20' height='20' /> Cabot by Arachnys</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -42,27 +42,27 @@
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li>
<a href="{% url services %}"><i class="fa fa-gears"></i> Services</a>
<a href="{% url "services" %}"><i class="fa fa-gears"></i> Services</a>
</li>
<li>
<a href="{% url checks %}"><i class="fa fa-cog"></i> Checks</a>
<a href="{% url "checks" %}"><i class="fa fa-cog"></i> Checks</a>
</li>
<ul class="nav navbar-nav navbar-left">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">New <span class="caret"></span></a>
<ul class="dropdown-menu" aria-labelledby="New">
<li>
<a href="{% url create-service %}"><i class="fa fa-gears"></i> Service</a>
<a href="{% url "create-service" %}"><i class="fa fa-gears"></i> Service</a>
</li>
<li class="divider"></li>
<li>
<a href="{% url create-check %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-signal" title="Add new metric check"></i> Graphite check</a>
<a href="{% url "create-check" %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-signal" title="Add new metric check"></i> Graphite check</a>
</li>
<li>
<a href="{% url create-http-check %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-arrow-up"></i> Http check</a>
<a href="{% url "create-http-check" %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-arrow-up"></i> Http check</a>
</li>
<li>
<a href="{% url create-jenkins-check %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-ok"></i> Jenkins check</a>
<a href="{% url "create-jenkins-check" %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-ok"></i> Jenkins check</a>
</li>
</ul>
</li>
@ -70,10 +70,10 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="{% url subscriptions %}"><i class="fa fa-table"></i> Alert subscriptions</a>
<a href="{% url "subscriptions" %}"><i class="fa fa-table"></i> Alert subscriptions</a>
</li>
<li>
<a href="{% url shifts %}"><i class="glyphicon glyphicon-time"></i> Duty rota</a>
<a href="{% url "shifts" %}"><i class="glyphicon glyphicon-time"></i> Duty rota</a>
</li>
{% if user.is_authenticated %}
<li class="dropdown">

View File

@ -7,13 +7,13 @@
<div class="col-xs-3 text-right">
<h3>
&nbsp;{% if checks_type == "All" or checks_type == "Graphite" %}
<a href="{% url create-check %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
<a href="{% url "create-check" %}?service={{ service.id }}" class=""><i class="glyphicon glyphicon-plus" title="Add new metric check"></i><i class="glyphicon glyphicon-signal" title="Add new metric check"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Http" %}
&nbsp;<a href="{% url create-http-check %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
&nbsp;<a href="{% url "create-http-check" %}?service={{ service.id }}" class="" title="Add new Http check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-arrow-up"></i></a>
{% endif %}
{% if checks_type == "All" or checks_type == "Jenkins" %}
&nbsp;<a href="{% url create-jenkins-check %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
&nbsp;<a href="{% url "create-jenkins-check" %}?service={{ service.id }}" class="" title="Add new Jenkins check"><i class="glyphicon glyphicon-plus"></i><i class="glyphicon glyphicon-ok"></i></a>
{% endif %}
</h3>
</div>
@ -44,7 +44,7 @@
{% for check in checks %}
<tr class="{% if check.active %}enabled{% else %}warning{% endif %}">
<td title="{{ check.name }} - alerts {% if check.active %}enabled{% else %}disabled{% endif %}">
<a href="{% url check pk=check.id %}">{{check.name}}</a>
<a href="{% url "check" pk=check.id %}">{{check.name}}</a>
</td>
<td title="{{ check.calculated_status }}">
{% if check.active %}
@ -71,7 +71,7 @@
<td>{{ check.get_importance_display }}</td>
<td>
{% for service in check.service_set.all %}
<a href="{% url service pk=service.id %}">{{ service.name }}</a>
<a href="{% url "service" pk=service.id %}">{{ service.name }}</a>
{% if forloop.last %}
{% else %}
/
@ -82,10 +82,10 @@
{% endif %}
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url update-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url update-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url update-jenkins-check pk=check.id %}{% endif %}">
<a class="btn btn-xs" href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url "update-check" pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url "update-http-check" pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url "update-jenkins-check" pk=check.id %}{% endif %}">
<i class="glyphicon glyphicon-edit"></i><span class="break"></span>
</a>
<a class="btn btn-xs" href="{% url run-check pk=check.id %}">
<a class="btn btn-xs" href="{% url "run-check" pk=check.id %}">
<i class="glyphicon glyphicon-refresh"></i><span class="break"></span>
</a>
{% if checks_type == "Jenkins" %}
@ -100,4 +100,4 @@
</table>
{% endif %}
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@
<div class="col-xs-1"><h2><i class="fa fa-gears"></i></h2></div>
<div class="col-xs-5"><h2><span class="break"></span>{{ service.name }}</h2></div>
<div class="col-xs-4 text-right"><h2><span class="label label-{% if service.overall_status == service.PASSING_STATUS %}success{% else %}danger{% endif %}">{{ service.overall_status|lower|capfirst }}</span> <span class="label label-{% if service.alerts_enabled %}success{% else %}warning{% endif %}">{% if service.alerts_enabled %}Alerts enabled{%else %}Alerts disabled{% endif %}</span></h2></div>
<div class="col-xs-2 text-right"><h2><a href="{% url update-service service.id %}"><i class="glyphicon glyphicon-edit"></i></a></h2></div>
<div class="col-xs-2 text-right"><h2><a href="{% url "update-service" service.id %}"><i class="glyphicon glyphicon-edit"></i></a></h2></div>
</div>
</div>
<hr>
@ -77,7 +77,7 @@
<h3>Status check report</h3>
</div>
<div class="col-xs-12">
<form action="{% url checks-report %}" method="get">
<form action="{% url "checks-report" %}" method="get">
<div class="form-group">
<div class="col-xs-12">
{{ report_form.service }}

View File

@ -14,11 +14,11 @@
<div class="form-group">
<div class="col-xs-6 col-xs-offset-2">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="{% url dashboard %}" class="btn">Back to dashboard</a>
<a href="{% url "dashboard" %}" class="btn">Back to dashboard</a>
</div>
{% if form.instance.id %}
<div class="col-xs-4">
<a class="btn btn-danger" href="{% url delete-service form.instance.id %}">Delete service</a>
<a class="btn btn-danger" href="{% url "delete-service" form.instance.id %}">Delete service</a>
</div>
{% endif %}
</div>

View File

@ -6,7 +6,7 @@
<div class="col-xs-1"><h2><i class="fa fa-gears"></i></h2></div>
<div class="col-xs-10"><h2><span class="break"></span>Services</h2></div>
<div class="col-xs-1 text-right">
<h2><a href="{% url create-service %}" title="New service"><i class="glyphicon glyphicon-plus"></i></a></h2>
<h2><a href="{% url "create-service" %}" title="New service"><i class="glyphicon glyphicon-plus"></i></a></h2>
</div>
</div>
<div class="col-xs-12">
@ -27,7 +27,7 @@
{% for service in services %}
<tr class="{% if service.alerts_enabled %}enabled{% else %}warning{% endif %}">
<td>
<a href="{% url service pk=service.id %}" title="Alerts {% if service.alerts_enabled %}enabled{% else %}disabled{% endif %}">{{service.name}} </a>
<a href="{% url "service" pk=service.id %}" title="Alerts {% if service.alerts_enabled %}enabled{% else %}disabled{% endif %}">{{service.name}} </a>
</td>
<td>
<span class="label label-{% if not service.alerts_enabled %}warning{% else %}{% if service.overall_status == service.PASSING_STATUS %}success{% else %}danger{% endif %}{% endif %}">{% if service.alerts_enabled %}{{ service.overall_status|lower|capfirst }}{% else %}Disabled{% endif %}</span>
@ -39,7 +39,7 @@
<span class="label label-{% if service.inactive_status_checks.all.count > 0 %}warning{% else %}default{% endif %}">{{ service.inactive_status_checks.all.count }}</span>
</td>
<td class="text-right">
<a class="btn btn-xs" href="{% url update-service pk=service.id %}" role="button">
<a class="btn btn-xs" href="{% url "update-service" pk=service.id %}" role="button">
<i class="glyphicon glyphicon-edit"></i>
</a>
</td>
@ -60,4 +60,4 @@
</script>
{% endcompress %}
{% endblock js %}
{% endblock js %}

View File

@ -22,7 +22,7 @@
{% for shift in shifts %}
<tr>
<td>
<a href="{% url user-profile pk=shift.user.id %}">{{ shift.user.username }}</a>
<a href="{% url "user-profile" pk=shift.user.id %}">{{ shift.user.username }}</a>
</td>
<td>
{{ shift.start }} - {{ shift.end }}
@ -49,4 +49,4 @@
</script>
{% endcompress %}
{% endblock js %}
{% endblock js %}

View File

@ -13,7 +13,7 @@
{% if check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}
<a href="{% jenkins_human_url check.name %}" class=""><i class="glyphicon glyphicon-link"></i></a>
{% endif %}
<a href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url update-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url update-http-check pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url update-jenkins-check pk=check.id %}{% endif %}" class=""><i class="glyphicon glyphicon-edit"></i></a> <a href="{% url run-check pk=check.id %}"><i class="glyphicon glyphicon-refresh"></i></a>
<a href="{% if check.polymorphic_ctype.model == 'graphitestatuscheck' %}{% url "update-check" pk=check.id %}{% elif check.polymorphic_ctype.model == 'httpstatuscheck' %}{% url "update-http-check" pk=check.id %}{% elif check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}{% url "update-jenkins-check" pk=check.id %}{% endif %}" class=""><i class="glyphicon glyphicon-edit"></i></a> <a href="{% url "run-check" pk=check.id %}"><i class="glyphicon glyphicon-refresh"></i></a>
</h2></div>
</div>
</div>
@ -45,7 +45,7 @@
</span>
</td>
<td>
<a href="{% url result pk=result.id %}">{{ result.time }}</a>
<a href="{% url "result" pk=result.id %}">{{ result.time }}</a>
</td>
<td>{{ result.time_complete }}</td>
<td>{{ result.took }}</td>
@ -63,7 +63,7 @@
{% if service.hackpad_id %}
<div class="col-xs-12">
<div class="col-xs-1"><h3><i class="fa fa-exclamation-triangle"></i></h3></div>
<div class="col-xs-11"><h3>Recovery instructions for linked service <a href="{% url service service.id %}">{{ service.name }}</a></h3></div>
<div class="col-xs-11"><h3>Recovery instructions for linked service <a href="{% url "service" service.id %}">{{ service.name }}</a></h3></div>
<div class="col-xs-12">
<script src="{{ service.hackpad_id }}"></script>
</div>
@ -81,4 +81,4 @@
</script>
{% endcompress %}
{% endblock js %}
{% endblock js %}

View File

@ -14,11 +14,11 @@
<div class="form-group">
<div class="col-xs-6 col-xs-offset-2">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="{% url dashboard %}" class="btn">Back to dashboard</a>
<a href="{% url "dashboard" %}" class="btn">Back to dashboard</a>
</div>
{% if form.instance.id %}
<div class="col-xs-4">
<a class="btn btn-danger" href="{% url delete-check form.instance.id %}">Delete check</a>
<a class="btn btn-danger" href="{% url "delete-check" form.instance.id %}">Delete check</a>
</div>
{% endif %}
</div>

View File

@ -5,7 +5,7 @@
<div class="col-xs-12">
<div class="col-xs-1"><h2><i class="glyphicon glyphicon-{% if result.check.polymorphic_ctype.model == 'graphitestatuscheck' %}signal{% elif result.check.polymorphic_ctype.model == 'httpstatuscheck' %}arrow-up{% elif result.check.polymorphic_ctype.model == 'jenkinsstatuscheck' %}ok{% endif %}"></i></h2></div>
<div class="col-xs-9">
<h2>Check result: <a href="{% url check result.check.id %}">{{ result.check.name }}</a></h2>
<h2>Check result: <a href="{% url "check" result.check.id %}">{{ result.check.name }}</a></h2>
</div>
<div class="col-xs-2 text-right"><h2><span class="label label-{% if result.succeeded %}success{% else %}danger{% endif %}">{{ result.status|capfirst }}</span></h2></div>
</div>
@ -56,4 +56,4 @@ Morris.Line
hideHover: true
</script>
{% endcompress %}
{% endblock js %}
{% endblock js %}

View File

@ -29,7 +29,7 @@
</span>
{% endif %}
{% endif %}
<a href="{% url user-profile pk=user.id %}" class="btn btn-xs">
<a href="{% url "user-profile" pk=user.id %}" class="btn btn-xs">
<i class="glyphicon glyphicon-edit"></i>
</a>
</th>
@ -40,7 +40,7 @@
{% for service in services %}
<tr class="{% if service.alerts_enabled %}enabled{% else %}warning{% endif %}" >
<td title="{{ check.description }}">
<a href="{% url update-service pk=service.id %}">{{service.name}}</a>
<a href="{% url "update-service" pk=service.id %}">{{service.name}}</a>
{% if service.email_alert %}<span class="label label-{% if service.alerts_enabled %}success{% else %}warning{% endif %}">email</span>{% endif %}
{% if service.hipchat_alert %}<span class="label label-{% if service.alerts_enabled %}success{% else %}warning{% endif %}">hipchat</span>{% endif %}
{% if service.sms_alert %}<span class="label label-{% if service.alerts_enabled %}success{% else %}warning{% endif %}">sms</span>{% endif %}
@ -63,4 +63,4 @@
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -17,7 +17,7 @@
<div class="form-group">
<div class="col-xs-6 col-xs-offset-2">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="{% url dashboard %}" class="btn">Back to dashboard</a>
<a href="{% url "dashboard" %}" class="btn">Back to dashboard</a>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div class="form-group">
<div class="col-xs-6 col-xs-offset-2">
<button type="submit" class="btn btn-primary">Log in</button>
<a href="{% url password-reset %}" class="btn">Reset password</a>
<a href="{% url "password-reset" %}" class="btn">Reset password</a>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
from django.conf.urls.defaults import patterns, include, url
from django.conf.urls import patterns, include, url
from cabot.cabotapp.views import (
run_status_check, graphite_api_data, twiml_callback, checks_run_recently,
GraphiteCheckCreateView, GraphiteCheckUpdateView,

View File

@ -16,9 +16,9 @@ setup(
'https://argparse.googlecode.com/files/argparse-1.2.1.tar.gz',
],
install_requires=[
'Django==1.4.10',
'Django==1.6.2',
'PyJWT==0.1.2',
'South==0.7.6',
'South==0.8.4',
'amqp==1.3.3',
'anyjson==0.3.3',
'billiard==3.3.0.13',
@ -28,7 +28,7 @@ setup(
'django-appconf==0.6',
'django-celery==3.1.1',
'django-celery-with-redis==3.0',
'django-compressor==1.2',
'django-compressor==1.3',
'django-dotenv==1.2',
'django-jsonify==0.2.1',
'django-mptt==0.6.0',