aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notifier/manager.py4
-rw-r--r--src/notifier/views.py4
-rw-r--r--src/resource_inventory/resource_manager.py2
-rw-r--r--src/templates/notifier/end_booking.html2
-rw-r--r--src/templates/notifier/inbox.html2
-rw-r--r--src/templates/notifier/new_booking.html2
-rw-r--r--src/templates/notifier/notification.html8
-rw-r--r--src/workflow/resource_bundle_workflow.py8
-rw-r--r--src/workflow/sw_bundle_workflow.py10
9 files changed, 30 insertions, 12 deletions
diff --git a/src/notifier/manager.py b/src/notifier/manager.py
index a754241..3361074 100644
--- a/src/notifier/manager.py
+++ b/src/notifier/manager.py
@@ -45,7 +45,7 @@ class NotificationHandler(object):
}
)
)
- owner_notif.recipients.add(booking.owner)
+ owner_notif.recipients.add(booking.owner.userprofile)
if not booking.collaborators.all().exists():
return # no collaborators - were done
@@ -60,7 +60,7 @@ class NotificationHandler(object):
)
)
for c in booking.collaborators.all():
- collab_notif.recipients.add(c)
+ collab_notif.recipients.add(c.userprofile)
@classmethod
def email_job_fulfilled(cls, job):
diff --git a/src/notifier/views.py b/src/notifier/views.py
index c1a2f7e..4ee757f 100644
--- a/src/notifier/views.py
+++ b/src/notifier/views.py
@@ -17,7 +17,7 @@ def InboxView(request):
else:
return render(request, "dashboard/login.html", {'title': 'Authentication Required'})
- return render(request, "notifier/inbox.html", {'notifications': Notification.objects.filter(recipient=user.userprofile)})
+ return render(request, "notifier/inbox.html", {'notifications': Notification.objects.filter(recipients=user.userprofile)})
def NotificationView(request, notification_id):
@@ -27,7 +27,7 @@ def NotificationView(request, notification_id):
return render(request, "dashboard/login.html", {'title': 'Authentication Required'})
notification = Notification.objects.get(id=notification_id)
- if user not in notification.recipients:
+ if user.userprofile not in notification.recipients.all():
return render(request, "dashboard/login.html", {'title': 'Access Denied'})
return render(request, "notifier/notification.html", {'notification': notification})
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py
index 3380990..9282580 100644
--- a/src/resource_inventory/resource_manager.py
+++ b/src/resource_inventory/resource_manager.py
@@ -15,7 +15,7 @@ from dashboard.exceptions import (
ResourceExistenceException,
ResourceAvailabilityException,
ResourceProvisioningException,
- ModelValidationException
+ ModelValidationException,
)
from resource_inventory.models import Host, HostConfiguration, ResourceBundle
diff --git a/src/templates/notifier/end_booking.html b/src/templates/notifier/end_booking.html
index 22014fb..a2981c1 100644
--- a/src/templates/notifier/end_booking.html
+++ b/src/templates/notifier/end_booking.html
@@ -30,7 +30,7 @@
</li>
</ul>
- <p>You can find more detailed information <a href=/booking/detail/{{booking.id/>Here</a></p>
+ <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
</div>
</body>
</html>
diff --git a/src/templates/notifier/inbox.html b/src/templates/notifier/inbox.html
index c0ee1ba..471eae4 100644
--- a/src/templates/notifier/inbox.html
+++ b/src/templates/notifier/inbox.html
@@ -56,7 +56,7 @@
<div class="inbox-panel">
<div class="section-panel">
<div class="card-container">
- {% for notification in notifier_messages %}
+ {% for notification in notifications %}
<div class="inbox-entry card" onclick="showmessage({{notification.id}}); setactive(this);">
{{ notification }}
</div>
diff --git a/src/templates/notifier/new_booking.html b/src/templates/notifier/new_booking.html
index 4b53875..d23b12e 100644
--- a/src/templates/notifier/new_booking.html
+++ b/src/templates/notifier/new_booking.html
@@ -28,7 +28,7 @@
</li>
</ul>
- <p>You can find more detailed information <a href=/booking/detail/{{booking.id/>Here</a></p>
+ <p>You can find more detailed information <a href=/booking/detail/{{booking.id}}/>Here</a></p>
</div>
</body>
</html>
diff --git a/src/templates/notifier/notification.html b/src/templates/notifier/notification.html
index 1258fe0..65d26c9 100644
--- a/src/templates/notifier/notification.html
+++ b/src/templates/notifier/notification.html
@@ -1,4 +1,8 @@
-{% load staticfiles %}
+{% extends "layout.html" %}
+{% block extrahead %}
+<base target="_parent">
+{% endblock %}
+{% block basecontent %}
<div class="card-container">
<h3 class="msg_header">{{notification.title}}</h3>
<p class="content"></p>
@@ -6,7 +10,6 @@
{{notification.content|safe}}
</pre>
-<p class="sender">Message from {{notification.sender}}</p>
</div>
<style media="screen">
@@ -32,3 +35,4 @@
</style>
+{% endblock %}
diff --git a/src/workflow/resource_bundle_workflow.py b/src/workflow/resource_bundle_workflow.py
index 9fb4ae1..712c92b 100644
--- a/src/workflow/resource_bundle_workflow.py
+++ b/src/workflow/resource_bundle_workflow.py
@@ -35,7 +35,8 @@ from dashboard.exceptions import (
InvalidVlanConfigurationException,
NetworkExistsException,
InvalidHostnameException,
- NonUniqueHostnameException
+ NonUniqueHostnameException,
+ ResourceAvailabilityException
)
import logging
@@ -233,6 +234,8 @@ class Define_Nets(WorkflowStep):
self.updateModels(xmlData)
# update model with xml
self.metastep.set_valid("Networks applied successfully")
+ except ResourceAvailabilityException:
+ self.metastep.set_invalid("Public network not availble")
except Exception:
self.metastep.set_invalid("An error occurred when applying networks")
return self.render(request)
@@ -261,6 +264,9 @@ class Define_Nets(WorkflowStep):
vlan_id = network['network']['vlan']
is_public = network['network']['public']
if is_public:
+ public_net = vlan_manager.get_public_vlan()
+ if public_net is None:
+ raise ResourceAvailabilityException("No public networks available")
vlan_id = vlan_manager.get_public_vlan().vlan
vlan = Vlan(vlan_id=vlan_id, tagged=network['tagged'], public=is_public)
models['vlans'][existing_host.resource.name][iface['profile_name']].append(vlan)
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py
index 56d0a5d..26ade22 100644
--- a/src/workflow/sw_bundle_workflow.py
+++ b/src/workflow/sw_bundle_workflow.py
@@ -69,7 +69,15 @@ class Define_Software(WorkflowStep):
user = self.repo_get(self.repo.SESSION_USER)
i = 0
for host_data in hosts_initial:
- host = GenericHost.objects.get(pk=host_data['host_id'])
+ host_profile = None
+ try:
+ host = GenericHost.objects.get(pk=host_data['host_id'])
+ host_profile = host.profile
+ except Exception:
+ for host in hostlist:
+ if host.resource.name == host_data['host_name']:
+ host_profile = host.profile
+ break
excluded_images = Image.objects.exclude(owner=user).exclude(public=True)
excluded_images = excluded_images | Image.objects.exclude(host_type=host.profile)
lab = self.repo_get(self.repo.SWCONF_SELECTED_GRB).lab