From 9f52dfc426fceec2324d9a011a6318becc70deb0 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Mon, 16 Mar 2020 13:45:54 -0400 Subject: Fix Server Interface Migration Before, the relation between host and interface was being lost Change-Id: I347ac71d7667adcedd2deea03edde155895e6a23 Signed-off-by: Parker Berberian --- src/resource_inventory/migrations/0013_auto_20200218_1536.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/resource_inventory') 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): """ -- cgit 1.2.3-korg