diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2019-04-29 12:42:48 -0400 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2019-04-29 12:45:37 -0400 |
commit | 2fec9e57b50fee61e896f820d28aa363982413e9 (patch) | |
tree | 15c61a51b5ae67aee2686c72913b552df1aa0241 /src/api | |
parent | fec940b7b8d15099b8f914ce35552c59db9eb77b (diff) |
Fix change/reset image with multiple collaborators
When a host on a booking with multiple collaborators
has its image reset/changed, a 500 error is no longer
returned
Change-Id: Icafdf53059f35c838e0de675da6a8b8bffffe58a
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/models.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/api/models.py b/src/api/models.py index 4ce8c3e..c5e54d7 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -774,14 +774,12 @@ class JobFactory(object): net_relation.status = JobStatus.NEW # re-apply ssh access after host is reset - ssh_relation = AccessRelation.objects.get(job=job, config__access_type="ssh") - ssh_relation.status = JobStatus.NEW + for relation in AccessRelation.objects.filter(job=job, config__access_type="ssh"): + relation.status = JobStatus.NEW + relation.save() - # save them all at once to reduce the chance - # of a lab polling and only seeing partial change hardware_relation.save() net_relation.save() - ssh_relation.save() @classmethod def makeSnapshotTask(cls, image, booking, host): |