From 899e1a4baa95d0bc6f0eef34de66f0e257174878 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Tue, 12 Nov 2019 12:54:20 -0500 Subject: Begin Resource Refactor Begins the Resource Refactor by creating new interfaces to the resources through a Resource super class and using that new interface in the api Change-Id: I15a8179bfe915d2cde6d658d056e11cbd2c70e43 Signed-off-by: Parker Berberian --- src/workflow/models.py | 2 +- src/workflow/opnfv_workflow.py | 2 +- src/workflow/snapshot_workflow.py | 2 +- src/workflow/workflow_manager.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/workflow') diff --git a/src/workflow/models.py b/src/workflow/models.py index 9d1fac2..99608f6 100644 --- a/src/workflow/models.py +++ b/src/workflow/models.py @@ -146,7 +146,7 @@ class BookingAuthManager(): return True # admin override for this user if Booking.objects.filter(owner=booking.owner, end__gt=timezone.now()).count() >= 3: return False - if len(booking.resource.template.getHosts()) < 2: + if len(booking.resource.template.getResources()) < 2: return True # if they only have one server, we dont care if repo.BOOKING_INFO_FILE not in repo.el: return False # INFO file not provided diff --git a/src/workflow/opnfv_workflow.py b/src/workflow/opnfv_workflow.py index a192d6e..0cac48e 100644 --- a/src/workflow/opnfv_workflow.py +++ b/src/workflow/opnfv_workflow.py @@ -202,7 +202,7 @@ class Assign_Host_Roles(WorkflowStep): # taken verbatim from Define_Software in if config is None: context['error'] = "Please select a Configuration on the first step" - formset = self.create_host_role_formset(hostlist=config.bundle.getHosts()) + formset = self.create_host_role_formset(hostlist=config.bundle.getResources()) context['formset'] = formset return context diff --git a/src/workflow/snapshot_workflow.py b/src/workflow/snapshot_workflow.py index 4266587..c2f4cd6 100644 --- a/src/workflow/snapshot_workflow.py +++ b/src/workflow/snapshot_workflow.py @@ -36,7 +36,7 @@ class Select_Host_Step(WorkflowStep): booking_hosts[booking.id]['start'] = booking.start.strftime("%Y-%m-%d") booking_hosts[booking.id]['end'] = booking.end.strftime("%Y-%m-%d") booking_hosts[booking.id]['hosts'] = [] - for genericHost in booking.resource.template.getHosts(): + for genericHost in booking.resource.template.getResources(): booking_hosts[booking.id]['hosts'].append({"name": genericHost.resource.name}) context['booking_hosts'] = booking_hosts diff --git a/src/workflow/workflow_manager.py b/src/workflow/workflow_manager.py index 4677829..fda105e 100644 --- a/src/workflow/workflow_manager.py +++ b/src/workflow/workflow_manager.py @@ -189,7 +189,7 @@ class SessionManager(): models['bundle'] = resource models['interfaces'] = {} models['vlans'] = {} - for host in resource.getHosts(): + for host in resource.getResources(): models['hosts'].append(host) models['interfaces'][host.resource.name] = [] models['vlans'][host.resource.name] = {} @@ -205,7 +205,7 @@ class SessionManager(): confirm['resource'] = {} confirm['resource']['hosts'] = [] confirm['resource']['lab'] = resource.lab.lab_user.username - for host in resource.getHosts(): + for host in resource.getResources(): confirm['resource']['hosts'].append({"name": host.resource.name, "profile": host.profile.name}) return confirm -- cgit 1.2.3-korg