diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-07-27 18:52:03 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2020-07-27 18:52:03 +0000 |
commit | 4d7fc79eabf45014960117ba70fd29add07327c2 (patch) | |
tree | 88e8964c0477c5d92bdde1964e58a0e7f096e8e1 | |
parent | dc115112cd0de9764ac6d8b4fb2dd1c0fc37bf59 (diff) | |
parent | a6de767f02153b46d964d551f10bc9561aa28d0c (diff) |
Merge "Make static OPNFV references dynamic"
-rw-r--r-- | src/account/migrations/0005_auto_20200723_2100.py | 23 | ||||
-rw-r--r-- | src/account/models.py | 2 | ||||
-rw-r--r-- | src/notifier/manager.py | 5 | ||||
-rw-r--r-- | src/resource_inventory/pdf_templater.py | 2 | ||||
-rw-r--r-- | src/templates/base/notifier/email_ended.txt | 6 | ||||
-rw-r--r-- | src/templates/base/notifier/email_expiring.txt | 6 | ||||
-rw-r--r-- | src/templates/base/notifier/email_fulfilled.txt | 4 | ||||
-rw-r--r-- | src/templates/base/notifier/end_booking.html | 6 | ||||
-rw-r--r-- | src/templates/base/notifier/expiring_booking.html | 2 | ||||
-rw-r--r-- | src/templates/base/notifier/new_booking.html | 2 |
10 files changed, 42 insertions, 16 deletions
diff --git a/src/account/migrations/0005_auto_20200723_2100.py b/src/account/migrations/0005_auto_20200723_2100.py new file mode 100644 index 0000000..d995f80 --- /dev/null +++ b/src/account/migrations/0005_auto_20200723_2100.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2 on 2020-07-23 21:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('account', '0004_downtime'), + ] + + operations = [ + migrations.AddField( + model_name='lab', + name='lab_info_link', + field=models.URLField(null=True), + ), + migrations.AddField( + model_name='lab', + name='project', + field=models.CharField(default='LaaS', max_length=100), + ), + ] diff --git a/src/account/models.py b/src/account/models.py index 9624a53..03b31df 100644 --- a/src/account/models.py +++ b/src/account/models.py @@ -205,6 +205,8 @@ class Lab(models.Model): # This token must apear in API requests from this lab api_token = models.CharField(max_length=50) description = models.CharField(max_length=240) + lab_info_link = models.URLField(null=True) + project = models.CharField(default='LaaS', max_length=100) @staticmethod def make_api_token(): diff --git a/src/notifier/manager.py b/src/notifier/manager.py index 6d75a79..8ea8021 100644 --- a/src/notifier/manager.py +++ b/src/notifier/manager.py @@ -1,5 +1,6 @@ ############################################################################## # Copyright (c) 2018 Parker Berberian, Sawyer Bergeron and others. +# Copyright (c) 2020 Sawyer Bergeron, 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 @@ -110,7 +111,7 @@ class NotificationHandler(object): @classmethod def email_booking_over(cls, booking): template_name = "notifier/email_ended.txt" - hostnames = [host.name for host in booking.resource.getResources()] + hostnames = [host.name for host in booking.resource.get_resources()] users = list(booking.collaborators.all()) users.append(booking.owner) for user in users: @@ -134,7 +135,7 @@ class NotificationHandler(object): @classmethod def email_booking_expiring(cls, booking): template_name = "notifier/email_expiring.txt" - hostnames = [host.name for host in booking.resource.getResources()] + hostnames = [host.name for host in booking.resource.get_resources()] users = list(booking.collaborators.all()) users.append(booking.owner) for user in users: diff --git a/src/resource_inventory/pdf_templater.py b/src/resource_inventory/pdf_templater.py index 27a264e..86d84aa 100644 --- a/src/resource_inventory/pdf_templater.py +++ b/src/resource_inventory/pdf_templater.py @@ -37,7 +37,7 @@ class PDFTemplater: lab = resource_lab.name location = resource_lab.location pod_type = "development" - link = "https://wiki.opnfv.org/display/INF/Laas" + link = resource_lab.lab_info_link try: # try to get more specific info that may fail, we dont care if it does diff --git a/src/templates/base/notifier/email_ended.txt b/src/templates/base/notifier/email_ended.txt index 1788e00..33a1ec5 100644 --- a/src/templates/base/notifier/email_ended.txt +++ b/src/templates/base/notifier/email_ended.txt @@ -1,9 +1,9 @@ {{user_name|default:"Developer"}}, {% if owner %} -The booking you requested from the OPNFV Lab as a Service has ended. +The booking you requested from the {{booking.lab.project}} Lab has ended. {% else %} -The booking you collaborated on at the OPNFV Lab as a Service has ended. +The booking you collaborated on at the {{booking.lab.project}} Lab has ended. {% endif %} booking information: @@ -20,6 +20,6 @@ You may visit the following link for more information: Feel free to create another booking with us! -Thank you for contributing to the OPNFV platform! +Thank you for contributing to the {{booking.lab.project}} platform! - The Lab-as-a-Service team diff --git a/src/templates/base/notifier/email_expiring.txt b/src/templates/base/notifier/email_expiring.txt index 72c9a83..d78e59f 100644 --- a/src/templates/base/notifier/email_expiring.txt +++ b/src/templates/base/notifier/email_expiring.txt @@ -1,9 +1,9 @@ {{user_name|default:"Developer"}}, {% if owner %} -The booking you requested from the OPNFV Lab as a Service is about to expire. +The booking you requested from the {{booking.lab.project}} lab is about to expire. {% else %} -The booking you collaborate on at the OPNFV Lab as a Service is about to expire. +The booking you collaborate on at the {{booking.lab.project}} lab is about to expire. {% endif %} booking information: @@ -20,6 +20,6 @@ You may visit the following link for more information: Please take the time to backup all data or extend the booking if needed. -Thank you for contributing to the OPNFV platform! +Thank you for contributing to the {{booking.lab.project}} platform! - The Lab-as-a-Service team diff --git a/src/templates/base/notifier/email_fulfilled.txt b/src/templates/base/notifier/email_fulfilled.txt index 90d294a..e3e07f9 100644 --- a/src/templates/base/notifier/email_fulfilled.txt +++ b/src/templates/base/notifier/email_fulfilled.txt @@ -1,7 +1,7 @@ {{user_name|default:"Developer"}}, {% if owner %} -The booking you requested of the OPNFV Lab as a Service has finished deploying and is ready for you to use. +The booking you requested of the {{booking.lab.project}} lab has finished deploying and is ready for you to use. {% else %} A booking you collaborate on is ready for you to use {% endif %} @@ -16,6 +16,6 @@ The lab that fulfilled your booking request has sent you the following messages: You may visit the following link for more information: {{booking_url}} -Thank you for contributing to the OPNFV platform! +Thank you for contributing to the {{booking.lab.project}} platform! - The Lab-as-a-Service team diff --git a/src/templates/base/notifier/end_booking.html b/src/templates/base/notifier/end_booking.html index a2981c1..ebad027 100644 --- a/src/templates/base/notifier/end_booking.html +++ b/src/templates/base/notifier/end_booking.html @@ -4,11 +4,11 @@ {% if owner %} <h3>Your booking has expired</h3> <p>Your booking has ended and the machines have been cleaned up.</p> - <p>Thank you for working on OPNFV, and feel free to book more machines if you need them.</p> + <p>Thank you for working on {{booking.lab.project}}, and feel free to book more machines if you need them.</p> {% else %} <h3>A booking that you collaborated on has expired</h3> <p>The booking owned by {{booking.owner.username}} that you worked on has ended</p> - <p>Thank you for contributing to OPNFV!</p> + <p>Thank you for contributing to {{booking.lab.project}}.</p> {% endif %} <p>Booking information:</p> <ul> @@ -22,7 +22,7 @@ <li>collaborators: <ul> {% for user in booking.collaborators.all %} - <li>user.username</li> + <li>{{user.username}}</li> {% empty %} <li>No collaborators</li> {% endfor %} diff --git a/src/templates/base/notifier/expiring_booking.html b/src/templates/base/notifier/expiring_booking.html index 8bfa689..89042fe 100644 --- a/src/templates/base/notifier/expiring_booking.html +++ b/src/templates/base/notifier/expiring_booking.html @@ -21,7 +21,7 @@ <li>collaborators: <ul> {% for user in booking.collaborators.all %} - <li>user.username</li> + <li>{{user.username}}</li> {% empty %} <li>No collaborators</li> {% endfor %} diff --git a/src/templates/base/notifier/new_booking.html b/src/templates/base/notifier/new_booking.html index 64244e0..7580694 100644 --- a/src/templates/base/notifier/new_booking.html +++ b/src/templates/base/notifier/new_booking.html @@ -20,7 +20,7 @@ <li>collaborators: <ul> {% for user in booking.collaborators.all %} - <li>user.username</li> + <li>{{user.username}}</li> {% empty %} <li>No collaborators</li> {% endfor %} |