diff options
Diffstat (limited to 'src/workflow/workflow_manager.py')
-rw-r--r-- | src/workflow/workflow_manager.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/workflow/workflow_manager.py b/src/workflow/workflow_manager.py index e31e14c..a48efe5 100644 --- a/src/workflow/workflow_manager.py +++ b/src/workflow/workflow_manager.py @@ -66,7 +66,7 @@ class SessionManager(): return reverse('booking:booking_detail', kwargs={'booking_id': self.result.id}) return "/" - def pop_workflow(self): + def pop_workflow(self, discard=False): multiple_wfs = len(self.workflows) > 1 if multiple_wfs: if self.workflows[-1].repository.el[Repository.RESULT]: # move result @@ -79,6 +79,8 @@ class SessionManager(): else: current_repo = prev_workflow.repository self.result = current_repo.el[current_repo.RESULT] + if discard: + current_repo.cancel() return multiple_wfs, self.result def status(self, request): @@ -164,14 +166,14 @@ class SessionManager(): confirmation = self.make_booking_confirm(booking) self.active_workflow().repository.el[self.active_workflow().repository.BOOKING_MODELS] = models self.active_workflow().repository.el[self.active_workflow().repository.CONFIRMATION] = confirmation - self.active_workflow().repository.el[self.active_workflow().repository.GRESOURCE_BUNDLE_MODELS] = self.make_grb_models(booking.resource.template) - self.active_workflow().repository.el[self.active_workflow().repository.SELECTED_GRESOURCE_BUNDLE] = self.make_grb_models(booking.resource.template)['bundle'] + self.active_workflow().repository.el[self.active_workflow().repository.RESOURCE_TEMPLATE_MODELS] = self.make_grb_models(booking.resource.template) + self.active_workflow().repository.el[self.active_workflow().repository.SELECTED_RESOURCE_TEMPLATE] = self.make_grb_models(booking.resource.template)['bundle'] self.active_workflow().repository.el[self.active_workflow().repository.CONFIG_MODELS] = self.make_config_models(booking.config_bundle) def prefill_resource(self, resource): models = self.make_grb_models(resource) confirm = self.make_grb_confirm(resource) - self.active_workflow().repository.el[self.active_workflow().repository.GRESOURCE_BUNDLE_MODELS] = models + self.active_workflow().repository.el[self.active_workflow().repository.RESOURCE_TEMPLATE_MODELS] = models self.active_workflow().repository.el[self.active_workflow().repository.CONFIRMATION] = confirm def prefill_config(self, config): @@ -180,10 +182,10 @@ class SessionManager(): self.active_workflow().repository.el[self.active_workflow().repository.CONFIG_MODELS] = models self.active_workflow().repository.el[self.active_workflow().repository.CONFIRMATION] = confirm grb_models = self.make_grb_models(config.bundle) - self.active_workflow().repository.el[self.active_workflow().repository.GRESOURCE_BUNDLE_MODELS] = grb_models + self.active_workflow().repository.el[self.active_workflow().repository.RESOURCE_TEMPLATE_MODELS] = grb_models def make_grb_models(self, resource): - models = self.active_workflow().repository.el.get(self.active_workflow().repository.GRESOURCE_BUNDLE_MODELS, {}) + models = self.active_workflow().repository.el.get(self.active_workflow().repository.RESOURCE_TEMPLATE_MODELS, {}) models['hosts'] = [] models['bundle'] = resource models['interfaces'] = {} |