From 219d6376a369bf62c78b7b092b605f96997a3599 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Tue, 28 Jul 2020 13:53:51 -0400 Subject: Fix Pod detail menu and re-imaging Signed-off-by: Sean Smith Change-Id: I483c9e9c6dc8d492cc9340ab42b6b2d518f52950 --- src/api/models.py | 6 +++--- src/booking/views.py | 2 +- src/templates/base/booking/booking_detail.html | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/api/models.py b/src/api/models.py index 960fc26..8de3ec7 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -880,13 +880,13 @@ class JobFactory(object): """Modify an existing job to reimage the given host.""" job = Job.objects.get(booking=booking) # make hardware task new - hardware_relation = HostHardwareRelation.objects.get(host=host, job=job) - hardware_relation.config.set_image(new_image.lab_id) + hardware_relation = HostHardwareRelation.objects.get(resource_id=host, job=job) + hardware_relation.config.image = new_image.lab_id hardware_relation.config.save() hardware_relation.status = JobStatus.NEW # re-apply networking after host is reset - net_relation = HostNetworkRelation.objects.get(host=host, job=job) + net_relation = HostNetworkRelation.objects.get(resource_id=host, job=job) net_relation.status = JobStatus.NEW # re-apply ssh access after host is reset diff --git a/src/booking/views.py b/src/booking/views.py index 3c95e07..bd57812 100644 --- a/src/booking/views.py +++ b/src/booking/views.py @@ -173,7 +173,7 @@ def booking_modify_image(request, booking_id): if timezone.now() > booking.end: return HttpResponse("unauthorized") new_image = Image.objects.get(id=form.cleaned_data['image_id']) - host = ResourceQuery.get(labid=form.cleaned_data['host_id']) + host = ResourceQuery.get(id=form.cleaned_data['host_id']) host.config.image = new_image host.config.save() JobFactory.reimageHost(new_image, booking, host) diff --git a/src/templates/base/booking/booking_detail.html b/src/templates/base/booking/booking_detail.html index fea2bb6..4b70f69 100644 --- a/src/templates/base/booking/booking_detail.html +++ b/src/templates/base/booking/booking_detail.html @@ -55,13 +55,13 @@
- {% for host in booking.resource.hosts.all %} -

{{host.template.resource.name}}

+ {% for host in booking.resource.get_resources %} +

{{host.bundle.template.copy_of.name}}

- + @@ -69,12 +69,12 @@ - +
Hostname:{{host.template.resource.name}}{{host.name}}
Machine:
Role:{{host.config.opnfvRole}}{{host.template.opnfvRole}}
Image: - {{host.config.image}} + {{host.config.Image}}