Skip to content
Permalink
Browse files
Merge branch 'python-package' of github.com:lincolnloop/cabot into li…
…ncolnloop-python-package

Conflicts:
	cabot/cabotapp/tests/basic.py
	cabot/cabotapp/views.py
	cabot/urls.py
	requirements.txt
  • Loading branch information
dbuxton committed Aug 3, 2014
2 parents cab908b + 8cf51d5 commit 38725651445df61eda06b86a6933317153088e4b
Show file tree
Hide file tree
Showing 149 changed files with 120 additions and 85 deletions.
@@ -5,10 +5,13 @@ backups/*
static/CACHE/*
node_modules/*
.python-eggs/*
cabot.egg-info
cabot/static/CACHE
.env
.DS_Store
celerybeat-schedule.db
celerybeat-schedule
*.pyc
*.swp
*.orig
.vagrant
conf/*.env
conf/*.env
@@ -1,2 +1,2 @@
web: gunicorn wsgi:application --config gunicorn.conf
celery: celery worker -B -A app.cabotapp.tasks --loglevel=INFO --concurrency=16 -Ofair
web: gunicorn cabot.wsgi:application --config gunicorn.conf
celery: celery worker -B -A cabot --loglevel=INFO --concurrency=16 -Ofair
@@ -1,2 +1,2 @@
web: python manage.py runserver 0.0.0.0:$PORT
celery: celeryd --loglevel=DEBUG -B -c 8 -Ofair
celery: celery -A cabot worker --loglevel=DEBUG -B -c 8 -Ofair

This file was deleted.

Empty file.
@@ -38,7 +38,7 @@ fi

npm install --no-color -g coffee-script less@1.3 --registry http://registry.npmjs.org/ # eco browserify

/home/vagrant/venv/bin/pip install --timeout=30 --exists-action=w -r /vagrant/requirements.txt --no-use-wheel
/home/vagrant/venv/bin/pip install --timeout=30 --exists-action=w -e /vagrant/ --no-use-wheel

# Start redis
sudo service redis-server restart
@@ -0,0 +1,5 @@
from __future__ import absolute_import

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -7,7 +7,7 @@
from django.contrib.admin.models import User
from celery.exceptions import SoftTimeLimitExceeded

from jenkins import get_job_status
from .jenkins import get_job_status
from .alert import send_alert
from .calendar import get_events
from .graphite import parse_metric
@@ -11,11 +11,6 @@
from django.conf import settings
from django.utils import timezone


# Add the root to the python path
root = os.path.abspath(os.path.join(settings.PROJECT_ROOT, '../'))
sys.path.append(root)

celery = Celery(__name__)
celery.config_from_object(settings)

File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -6,7 +6,7 @@
from django.test import TestCase
from django.contrib.auth.models import User
from django.test.client import Client
from cabotapp.models import (
from cabot.cabotapp.models import (
GraphiteStatusCheck, JenkinsStatusCheck,
HttpStatusCheck, ICMPStatusCheck, Service, Instance, StatusCheckResult)
from cabotapp.views import StatusCheckReportForm
@@ -166,7 +166,7 @@ def test_calculate_service_status(self):
self.service.update_status()
self.assertEqual(self.service.overall_status, Service.PASSING_STATUS)

@patch('cabotapp.graphite.requests.get', fake_graphite_response)
@patch('cabot.cabotapp.graphite.requests.get', fake_graphite_response)
def test_graphite_run(self):
checkresults = self.graphite_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 2)
@@ -188,7 +188,7 @@ def test_graphite_run(self):
self.assertEqual(self.graphite_check.calculated_status,
Service.CALCULATED_PASSING_STATUS)

@patch('cabotapp.jenkins.requests.get', fake_jenkins_response)
@patch('cabot.cabotapp.jenkins.requests.get', fake_jenkins_response)
def test_jenkins_run(self):
checkresults = self.jenkins_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
@@ -197,7 +197,7 @@ def test_jenkins_run(self):
self.assertEqual(len(checkresults), 1)
self.assertFalse(self.jenkins_check.last_result().succeeded)

@patch('cabotapp.jenkins.requests.get', jenkins_blocked_response)
@patch('cabot.cabotapp.jenkins.requests.get', jenkins_blocked_response)
def test_jenkins_blocked_build(self):
checkresults = self.jenkins_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
@@ -206,7 +206,7 @@ def test_jenkins_blocked_build(self):
self.assertEqual(len(checkresults), 1)
self.assertFalse(self.jenkins_check.last_result().succeeded)

@patch('cabotapp.models.requests.get', throws_timeout)
@patch('cabot.cabotapp.models.requests.get', throws_timeout)
def test_timeout_handling_in_jenkins(self):
checkresults = self.jenkins_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
@@ -217,7 +217,7 @@ def test_timeout_handling_in_jenkins(self):
self.assertIn(u'Error fetching from Jenkins - фиктивная ошибка',
self.jenkins_check.last_result().error)

@patch('cabotapp.models.requests.get', fake_http_200_response)
@patch('cabot.cabotapp.models.requests.get', fake_http_200_response)
def test_http_run(self):
checkresults = self.http_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
@@ -241,7 +241,7 @@ def test_http_run(self):
self.assertEqual(self.http_check.calculated_status,
Service.CALCULATED_FAILING_STATUS)

@patch('cabotapp.models.requests.get', throws_timeout)
@patch('cabot.cabotapp.models.requests.get', throws_timeout)
def test_timeout_handling_in_http(self):
checkresults = self.http_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
@@ -252,7 +252,7 @@ def test_timeout_handling_in_http(self):
self.assertIn(u'Request error occurred: фиктивная ошибка innit',
self.http_check.last_result().error)

@patch('cabotapp.models.requests.get', fake_http_404_response)
@patch('cabot.cabotapp.models.requests.get', fake_http_404_response)
def test_http_run_bad_resp(self):
checkresults = self.http_check.statuscheckresult_set.all()
self.assertEqual(len(checkresults), 0)
File renamed without changes.
@@ -0,0 +1,17 @@
from __future__ import absolute_import

import os

from celery import Celery

from django.conf import settings

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cabot.settings')

app = Celery('cabot')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@@ -2,7 +2,7 @@
from datetime import timedelta

BROKER_URL = os.environ['CELERY_BROKER_URL']
CELERY_IMPORTS = ('app.cabotapp.tasks', )
CELERY_IMPORTS = ('cabot.cabotapp.tasks', )
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
CELERY_TASK_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ['json', 'msgpack', 'yaml']
@@ -11,11 +11,11 @@

CELERYBEAT_SCHEDULE = {
'run-all-checks': {
'task': 'app.cabotapp.tasks.run_all_checks',
'task': 'cabot.cabotapp.tasks.run_all_checks',
'schedule': timedelta(seconds=60),
},
'update-shifts': {
'task': 'app.cabotapp.tasks.update_shifts',
'task': 'cabot.cabotapp.tasks.update_shifts',
'schedule': timedelta(seconds=1800),
},
'clean-db': {
@@ -2,7 +2,7 @@
import dj_database_url

settings_dir = os.path.dirname(__file__)
PROJECT_ROOT = os.path.abspath(os.path.dirname(settings_dir))
PROJECT_ROOT = os.path.abspath(settings_dir)

TEMPLATE_DEBUG = DEBUG = os.environ.get("DEBUG", False)

@@ -56,7 +56,7 @@
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static/')
STATIC_ROOT = os.path.join(PROJECT_ROOT, os.path.pardir, 'static/')

COMPRESS_ROOT = STATIC_ROOT

@@ -65,7 +65,7 @@
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = []
STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, 'static')]

# List of finder classes that know how to find static files in
# various locations.
@@ -94,10 +94,10 @@
'django.middleware.transaction.TransactionMiddleware',
)

ROOT_URLCONF = 'app.urls'
ROOT_URLCONF = 'cabot.urls'

TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, 'app/templates/'),
os.path.join(PROJECT_ROOT, 'templates'),
)

INSTALLED_APPS = (
@@ -117,7 +117,7 @@
'djcelery',
'mptt',
'jsonify',
'app.cabotapp',
'cabot.cabotapp',
)


@@ -208,5 +208,5 @@
}
}

from celeryconfig import *
from cabot_config import *
from cabot.celeryconfig import *
from cabot.cabot_config import *
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.