--- /dev/null
+# 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),
+ ),
+ ]
from collections import Counter
+
class LabStatus(object):
"""
A Poor man's enum for the status of a lab.
# 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():
def get_available_resources(self):
# Cannot import model normally due to ciruclar import
- Server = apps.get_model('resource_inventory', 'Server') # TODO: Find way to import ResourceQuery
+ Server = apps.get_model('resource_inventory', 'Server') # TODO: Find way to import ResourceQuery
resources = [str(resource.profile) for resource in Server.objects.filter(lab=self, booked=False)]
return dict(Counter(resources))
##############################################################################
# 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
@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:
@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:
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
{{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:
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
{{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:
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
{{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 %}
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
{% 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>
<li>collaborators:
<ul>
{% for user in booking.collaborators.all %}
- <li>user.username</li>
+ <li>{{user.username}}</li>
{% empty %}
<li>No collaborators</li>
{% endfor %}
<li>collaborators:
<ul>
{% for user in booking.collaborators.all %}
- <li>user.username</li>
+ <li>{{user.username}}</li>
{% empty %}
<li>No collaborators</li>
{% endfor %}
<li>collaborators:
<ul>
{% for user in booking.collaborators.all %}
- <li>user.username</li>
+ <li>{{user.username}}</li>
{% empty %}
<li>No collaborators</li>
{% endfor %}