diff options
-rw-r--r-- | src/api/models.py | 2 | ||||
-rw-r--r-- | src/dashboard/testing_utils.py | 2 | ||||
-rw-r--r-- | src/resource_inventory/migrations/0013_auto_20200218_1536.py | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/api/models.py b/src/api/models.py index d8e023b..df9bbf7 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -947,7 +947,7 @@ class JobFactory(object): for res in resources: hardware_config = None try: - hardware_config = HardwareConfig.objects.get(relation__host=res) + hardware_config = HardwareConfig.objects.get(relation__resource_id=res.labid) except Exception: hardware_config = HardwareConfig() diff --git a/src/dashboard/testing_utils.py b/src/dashboard/testing_utils.py index 01bb9c2..506e998 100644 --- a/src/dashboard/testing_utils.py +++ b/src/dashboard/testing_utils.py @@ -122,7 +122,7 @@ def make_resource_config(template, profile=None, image=None): profile = make_resource_profile(lab=template.lab) if image is None: - image = make_image(profile) + image = make_image(profile, lab=template.lab) return ResourceConfiguration.objects.create(profile=profile, image=image, template=template) 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): """ |