aboutsummaryrefslogtreecommitdiffstats
path: root/src/laas_dashboard
diff options
context:
space:
mode:
authorJustin Choquette <jchoquette@iol.unh.edu>2023-06-08 12:46:53 -0400
committerJustin Choquette <jchoquette@iol.unh.edu>2023-07-21 13:17:51 -0400
commita09db9f287a02873c0226759f8ea444bb304cd59 (patch)
tree59e744e4b998973a808abbae2d21fbdd6201d829 /src/laas_dashboard
parent8ddc7e820e120f1dde4e901d3cb6f1dd3f281e65 (diff)
LaaS 3.0 Almost MVP
Change-Id: Ided9a43cf3088bb58a233dc459711c03f43e11b8 Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/laas_dashboard')
-rw-r--r--src/laas_dashboard/model_test.py110
-rw-r--r--src/laas_dashboard/settings.py26
-rw-r--r--src/laas_dashboard/urls.py2
3 files changed, 2 insertions, 136 deletions
diff --git a/src/laas_dashboard/model_test.py b/src/laas_dashboard/model_test.py
deleted file mode 100644
index ba3ef35..0000000
--- a/src/laas_dashboard/model_test.py
+++ /dev/null
@@ -1,110 +0,0 @@
-##############################################################################
-# Copyright (c) 2020 Sawyer Bergeron, Parker Berberian, Sean Smith, 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
-##############################################################################
-
-
-from resource_inventory.models import (
- ResourceProfile,
- ResourceQuery,
- Image,
- DiskProfile,
- CpuProfile,
- RamProfile,
- InterfaceProfile,
-)
-
-
-def rp_has_all_components():
- """
- Check that every ResourceProfile has an InterfaceProfile,
- DiskProfile, CpuProfile, and RamProfile.
- """
-
- result = True
-
- for rp in ResourceProfile.objects.all():
- ip = InterfaceProfile.objects.filter(host=rp).exists()
- dp = DiskProfile.objects.filter(host=rp).exists()
- cp = CpuProfile.objects.filter(host=rp).exists()
- ram = RamProfile.objects.filter(host=rp).exists()
-
- if not ip:
- print("No InterfaceProfiles for host", rp.name)
- result = False
-
- if not dp:
- print("No DiskProfile for host", rp.name)
- result = False
-
- if not cp:
- print("No CpuProfile for host", rp.name)
- result = False
-
- if not ram:
- print("No RamProfile for host", rp.name)
- result = False
-
- return result
-
-
-def ip_for_all_ifaces():
- """
- Check that every InterfaceProfile for a Resource has
- an Interface.
- """
-
- result = True
-
- for res in ResourceQuery.filter():
- iface_set = res.get_interfaces()
- iface_profile_set = InterfaceProfile.objects.filter(host=res.profile)
-
- # find out what profiles we have
- curr_profiles = [iface.profile for iface in iface_set]
- missing_profiles = set(iface_profile_set) - set(curr_profiles)
-
- if missing_profiles:
- print('No interface for profiles', missing_profiles, 'for host', res.name)
- result = False
-
- return result
-
-
-def rp_has_image():
- """
- Make sure every ResourceProfile has an Image.
- """
-
- result = True
-
- rp_set = ResourceProfile.objects.all()
- image_set = Image.objects.all()
- image_profiles = set([image.host_type for image in image_set])
-
- for rp in rp_set:
- if rp not in image_profiles:
- print("ResourceProfile", rp.name, "has no image associated with it.")
- result = False
- return result
-
-
-def run_test(test):
- print('RUNNING TEST', test)
- result = test()
- if result:
- print(test, 'WAS A SUCCESS!')
- else:
- print(test, 'FAILED')
- print('============================================')
-
-
-def run_tests():
- tests = [rp_has_all_components, ip_for_all_ifaces, rp_has_image]
-
- for test in tests:
- run_test(test)
diff --git a/src/laas_dashboard/settings.py b/src/laas_dashboard/settings.py
index 7e27c8d..66de35d 100644
--- a/src/laas_dashboard/settings.py
+++ b/src/laas_dashboard/settings.py
@@ -220,35 +220,13 @@ RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS']
CELERY_BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//'
CELERY_BEAT_SCHEDULE = {
+ # Keeping commented as an example for the future
'booking_poll': {
- 'task': 'dashboard.tasks.booking_poll',
+ 'task': 'dashboard.tasks.end_expired_bookings',
'schedule': timedelta(minutes=1)
- },
- 'free_hosts': {
- 'task': 'dashboard.tasks.free_hosts',
- 'schedule': timedelta(minutes=1)
- },
- 'notify_expiring': {
- 'task': 'notifier.tasks.notify_expiring',
- 'schedule': timedelta(hours=1)
- },
- 'query_vpn_users': {
- 'task': 'dashboard.tasks.query_vpn_users',
- 'schedule': timedelta(hours=1)
- },
- 'dispatch_emails': {
- 'task': 'notifier.tasks.dispatch_emails',
- 'schedule': timedelta(minutes=10)
}
}
# Notifier Settings
-EMAIL_HOST = os.environ.get('EMAIL_HOST')
-EMAIL_PORT = os.environ.get('EMAIL_PORT')
-EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
-EMAIL_HOST_PASSWORD = os.environ.get('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"
EXPIRE_LIFETIME = 12 # Minimum lifetime of booking to send notification
EXPIRE_HOURS = 48 # Notify when booking is expiring within this many hours
diff --git a/src/laas_dashboard/urls.py b/src/laas_dashboard/urls.py
index 7a37d7e..f78e9ff 100644
--- a/src/laas_dashboard/urls.py
+++ b/src/laas_dashboard/urls.py
@@ -37,11 +37,9 @@ urlpatterns = [
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'^messages/', include('notifier.urls', namespace='notifier')),
url(r'^oidc/', include('mozilla_django_oidc.urls')),
]