summaryrefslogtreecommitdiffstats
path: root/dashboard/src/booking
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-01-23 13:47:56 -0500
committerParker Berberian <pberberian@iol.unh.edu>2019-01-23 13:47:56 -0500
commitbf13ea4e6d585afcad789a7b56956469453a2f73 (patch)
tree6c5a315059aa05e40e88cff44d0762eed2cc2b2b /dashboard/src/booking
parent93ac1cd683998a10c408069f72c421673f7ddfee (diff)
Fix Reimaging Hosts
When a User wants to reimage a host, the dashboard needs to also refresh the network and ssh configurations. Otherwise a host is reimaged and becomes unreachable. Change-Id: I534f200498c9217bda81190861021c482e052a81 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'dashboard/src/booking')
-rw-r--r--dashboard/src/booking/views.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/dashboard/src/booking/views.py b/dashboard/src/booking/views.py
index 3be9c7b..1e14b8e 100644
--- a/dashboard/src/booking/views.py
+++ b/dashboard/src/booking/views.py
@@ -23,7 +23,7 @@ from account.models import Lab
from booking.models import Booking
from booking.stats import StatisticsManager
from booking.forms import HostReImageForm
-from api.models import HostHardwareRelation, JobStatus
+from api.models import JobFactory
from workflow.views import login
from booking.forms import QuickBookingForm
from booking.quick_deployer import create_from_form, drop_filter
@@ -179,12 +179,9 @@ def booking_modify_image(request, booking_id):
return HttpResponse("unauthorized")
new_image = Image.objects.get(id=form.cleaned_data['image_id'])
host = Host.objects.get(id=form.cleaned_data['host_id'])
- relation = HostHardwareRelation.objects.get(host=host, job__booking=booking)
- config = relation.config
- config.set_image(new_image.lab_id)
- config.save()
- relation.status = JobStatus.NEW
- relation.save()
+ host.config.image = new_image
+ host.config.save()
+ JobFactory.reimageHost(new_image, booking, host)
return HttpResponse(new_image.name)
return HttpResponse("error")