diff options
author | Sawyer Bergeron <sawyerbergeron@gmail.com> | 2018-12-14 16:05:47 -0500 |
---|---|---|
committer | Sawyer Bergeron <sawyerbergeron@gmail.com> | 2019-01-03 10:34:13 -0500 |
commit | f27e25c199c3c5c9433463732b776ae9b4357cf8 (patch) | |
tree | d684ed4b89355db5050021b4aaaf505d4de70bc8 /src/workflow/sw_bundle_workflow.py | |
parent | e26a8259dbe879d722d5e619f9d6efe0b113d1cd (diff) |
Implement Segmented Workflows
A major source of bugs has been how we've approached inlining
workflows. We no longer inline them as of this commit, and instead
use a stack structure. This commits the result of workflows to the
database before other workflows try to read them, so we don't have
to maintain a code path for when something is or isn't committed
to db.
This patchset allows for workflows to pass limited information
to preset selections
Change-Id: I3d040c7f3024c7420017ae4ec66a23219303dcb6
Signed-off-by: Sawyer Bergeron <sawyerbergeron@gmail.com>
Diffstat (limited to 'src/workflow/sw_bundle_workflow.py')
-rw-r--r-- | src/workflow/sw_bundle_workflow.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py index 26ade22..a9be4ea 100644 --- a/src/workflow/sw_bundle_workflow.py +++ b/src/workflow/sw_bundle_workflow.py @@ -20,16 +20,9 @@ from resource_inventory.models import Image, GenericHost, ConfigBundle, HostConf class SWConf_Resource_Select(Resource_Select): def __init__(self, *args, **kwargs): super(SWConf_Resource_Select, self).__init__(*args, **kwargs) - self.repo_key = self.repo.SWCONF_SELECTED_GRB + self.repo_key = self.repo.SELECTED_GRESOURCE_BUNDLE self.confirm_key = "configuration" - def get_default_entry(self): - booking_grb = self.repo_get(self.repo.BOOKING_SELECTED_GRB) - if booking_grb: - return booking_grb - created_grb = self.repo_get(self.repo.GRESOURCE_BUNDLE_MODELS, {}).get("bundle", None) - return created_grb - def post_render(self, request): response = super(SWConf_Resource_Select, self).post_render(request) models = self.repo_get(self.repo.CONFIG_MODELS, {}) @@ -80,7 +73,7 @@ class Define_Software(WorkflowStep): break excluded_images = Image.objects.exclude(owner=user).exclude(public=True) excluded_images = excluded_images | Image.objects.exclude(host_type=host.profile) - lab = self.repo_get(self.repo.SWCONF_SELECTED_GRB).lab + lab = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE).lab excluded_images = excluded_images | Image.objects.exclude(from_lab=lab) filter_data["id_form-" + str(i) + "-image"] = [] for image in excluded_images: @@ -91,7 +84,7 @@ class Define_Software(WorkflowStep): def get_host_list(self, grb=None): if grb is None: - grb = self.repo_get(self.repo.SWCONF_SELECTED_GRB, False) + grb = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE, False) if not grb: return [] if grb.id: @@ -102,7 +95,7 @@ class Define_Software(WorkflowStep): def get_context(self): context = super(Define_Software, self).get_context() - grb = self.repo_get(self.repo.SWCONF_SELECTED_GRB, False) + grb = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE, False) if grb: context["grb"] = grb @@ -134,7 +127,7 @@ class Define_Software(WorkflowStep): i += 1 image = form.cleaned_data['image'] # checks image compatability - grb = self.repo_get(self.repo.SWCONF_SELECTED_GRB) + grb = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE) lab = None if grb: lab = grb.lab |