diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2018-10-10 16:06:47 -0400 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2018-10-15 13:16:11 -0400 |
commit | 1f3a770d2547848590f39e9d9b9bdffeb94eec14 (patch) | |
tree | 97222e5facd1a242d951c38482315057b5790d51 /src/pharos_dashboard | |
parent | 6d4019e59eda897384e9c00d1daf8b2ce87d128f (diff) |
Lab as a Service 2.0
See changes here:
https://wiki.opnfv.org/display/INF/Pharos+Laas
Change-Id: I59ada5f98e70a28d7f8c14eab3239597e236ca26
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/pharos_dashboard')
-rw-r--r-- | src/pharos_dashboard/settings.py | 52 | ||||
-rw-r--r-- | src/pharos_dashboard/urls.py | 11 |
2 files changed, 35 insertions, 28 deletions
diff --git a/src/pharos_dashboard/settings.py b/src/pharos_dashboard/settings.py index 8155fd4..7fccb32 100644 --- a/src/pharos_dashboard/settings.py +++ b/src/pharos_dashboard/settings.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2018 Sawyer Bergeron and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## import os from datetime import timedelta @@ -8,15 +16,18 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # NOTE: os.environ only returns strings, so making a comparison to # 'True' here will convert it to the correct Boolean value. DEBUG = os.environ['DEBUG'] == 'True' +TESTING = os.environ['TEST'] == 'True' # Application definition INSTALLED_APPS = [ 'dashboard', + 'resource_inventory', 'booking', 'account', - 'jenkins', 'notifier', + 'workflow', + 'api', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -51,6 +62,7 @@ TEMPLATES = [ 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ + 'dashboard.context_processors.debug', 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', @@ -60,6 +72,10 @@ TEMPLATES = [ }, ] +TEMPLATE_CONTEXT_PROCESSORS = [ + 'dashboard.context_processors.debug', +] + WSGI_APPLICATION = 'pharos_dashboard.wsgi.application' # Password validation @@ -128,13 +144,12 @@ DATABASES = { } } - # Rest API Settings REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' ], - 'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',), + 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.FilterSet',), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', @@ -170,32 +185,20 @@ RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS'] BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' -BOOKING_EXP_TIME = os.environ['BOOKING_EXPIRE_TIME'] -BOOKING_MAX_NUM = os.environ['BOOKING_MAXIMUM_NUMBER'] - CELERYBEAT_SCHEDULE = { - 'sync-jenkins': { - 'task': 'jenkins.tasks.sync_jenkins', - 'schedule': timedelta(minutes=5) - }, - 'send-booking-notifications': { - 'task': 'notification.tasks.send_booking_notifications', - 'schedule': timedelta(minutes=5) + 'booking_poll': { + 'task': 'dashboard.tasks.booking_poll', + 'schedule': timedelta(minutes=1) }, - 'clean-database': { - 'task': 'dashboard.tasks.database_cleanup', - 'schedule': timedelta(hours=24) + 'free_hosts': { + 'task': 'dashboard.tasks.free_hosts', + 'schedule': timedelta(minutes=1) }, - 'booking_cleanup': { - 'task': 'dashboard.tasks.booking_cleanup', - 'schedule': timedelta(hours=24) + 'conjure_notifiers': { + 'task': 'dashboard.tasks.conjure_aggregate_notifiers', + 'schedule': timedelta(seconds=30) }, } -# Jenkins Settings -ALL_SLAVES_URL = os.environ['JENKINS_URL'] + '/computer/api/json?tree=computer[displayName,offline,idle]' -CI_SLAVES_URL = os.environ['JENKINS_URL'] + '/label/ci-pod/api/json?tree=nodes[nodeName,offline,idle]' -ALL_JOBS_URL = os.environ['JENKINS_URL'] + '/api/json?tree=jobs[displayName,url,lastBuild[fullDisplayName,building,builtOn,timestamp,result]' -GET_SLAVE_URL = os.environ['JENKINS_URL'] + '/computer/' # Notifier Settings EMAIL_HOST = os.environ['EMAIL_HOST'] @@ -204,3 +207,4 @@ EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER'] EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD'] EMAIL_USE_TLS=True DEFAULT_EMAIL_FROM = os.environ.get('DEFAULT_EMAIL_FROM', 'webmaster@localhost') +SESSION_ENGINE="django.contrib.sessions.backends.signed_cookies" diff --git a/src/pharos_dashboard/urls.py b/src/pharos_dashboard/urls.py index adcb5b8..8535bed 100644 --- a/src/pharos_dashboard/urls.py +++ b/src/pharos_dashboard/urls.py @@ -1,5 +1,6 @@ ############################################################################## # Copyright (c) 2016 Max Breitenfeldt and others. +# Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -30,15 +31,17 @@ from django.contrib import admin urlpatterns = [ + + url(r'^wf/', include('workflow.urls', namespace='workflow')), url(r'^', include('dashboard.urls', namespace='dashboard')), url(r'^booking/', include('booking.urls', namespace='booking')), url(r'^accounts/', include('account.urls', namespace='account')), - + url(r'^resource/', include('resource_inventory.urls', namespace='resource')), url(r'^admin/', admin.site.urls), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), - - url(r'^api/', include('api.urls')) + url(r'^api/', include('api.urls')), + url(r'^messages/', include('notifier.urls', namespace='notifier')) ] if settings.DEBUG is True: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
\ No newline at end of file + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |