aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-03-16 13:45:54 -0400
committerSawyer Bergeron <sbergeron@iol.unh.edu>2020-03-16 19:12:13 +0000
commit9f52dfc426fceec2324d9a011a6318becc70deb0 (patch)
tree9ec61fa8624da02717c21df311bb345ed3313a00 /src/resource_inventory
parentb360e0e417f787e0266268596d630b87e88283d1 (diff)
Fix Server Interface Migration
Before, the relation between host and interface was being lost Change-Id: I347ac71d7667adcedd2deea03edde155895e6a23 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/resource_inventory')
-rw-r--r--src/resource_inventory/migrations/0013_auto_20200218_1536.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/resource_inventory/migrations/0013_auto_20200218_1536.py b/src/resource_inventory/migrations/0013_auto_20200218_1536.py
index 014cb2f..d9dcbd6 100644
--- a/src/resource_inventory/migrations/0013_auto_20200218_1536.py
+++ b/src/resource_inventory/migrations/0013_auto_20200218_1536.py
@@ -25,7 +25,7 @@ def populate_servers(apps, schema_editor):
ResourceProfile = apps.get_model('resource_inventory', 'ResourceProfile')
for h in Host.objects.all():
rp = ResourceProfile.objects.get(id=h.profile.id)
- Server.objects.create(
+ server = Server.objects.create(
working=h.working,
vendor=h.vendor,
labid=h.labid,
@@ -35,6 +35,9 @@ def populate_servers(apps, schema_editor):
profile=rp
)
+ for iface in h.interfaces.all():
+ server.interfaces.add(iface)
+
def populate_resource_templates(apps, schema_editor):
"""