aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-01-30 13:40:15 -0500
committerParker Berberian <pberberian@iol.unh.edu>2019-02-12 13:40:30 -0500
commit37620c753acf540e3c16364419617ebeb0388c5b (patch)
treef624c3bda350729b83b23dd79c9d077c378f5ea3 /src/workflow
parent33ce5acd438fbb81522fffeb81e2d1a58861b57f (diff)
Fixed all Flake8 errors
Change-Id: I1186429df8989461e2384f1f3e533c55cebfb1b4 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/workflow')
-rw-r--r--src/workflow/booking_workflow.py4
-rw-r--r--src/workflow/models.py6
-rw-r--r--src/workflow/sw_bundle_workflow.py4
-rw-r--r--src/workflow/workflow_factory.py5
-rw-r--r--src/workflow/workflow_manager.py15
5 files changed, 20 insertions, 14 deletions
diff --git a/src/workflow/booking_workflow.py b/src/workflow/booking_workflow.py
index 76950b8..8be7720 100644
--- a/src/workflow/booking_workflow.py
+++ b/src/workflow/booking_workflow.py
@@ -115,7 +115,7 @@ class Booking_Resource_Select(Resource_Select):
if resource:
try:
booking.resource.template = resource
- except:
+ except Exception:
booking.resource = ResourceBundle(template=resource)
models['booking'] = booking
self.repo_put(self.repo.BOOKING_MODELS, models)
@@ -182,7 +182,7 @@ class SWConfig_Select(WorkflowStep):
chosen_bundle = booking.config_bundle
default.append(chosen_bundle.id)
bundle = chosen_bundle
- except:
+ except Exception:
if created_bundle:
default.append(created_bundle.id)
bundle = created_bundle
diff --git a/src/workflow/models.py b/src/workflow/models.py
index 4e79546..21f3a8e 100644
--- a/src/workflow/models.py
+++ b/src/workflow/models.py
@@ -310,8 +310,8 @@ class Repository():
SNAPSHOT_DESC = "description of the snapshot"
BOOKING_INFO_FILE = "the INFO.yaml file for this user's booking"
- #migratory elements of segmented workflow
- #each of these is the end result of a different workflow.
+ # migratory elements of segmented workflow
+ # each of these is the end result of a different workflow.
HAS_RESULT = "whether or not workflow has a result"
RESULT_KEY = "key for target index that result will be put into in parent"
RESULT = "result object from workflow"
@@ -445,7 +445,7 @@ class Repository():
try:
interface.host = interface.host
interface.save()
- except Exception as e:
+ except Exception:
return "GRB, saving interface " + str(interface) + " failed. CODE:0x0019"
else:
return "GRB, no interface set provided. CODE:0x001a"
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py
index 80d1b3d..fd41018 100644
--- a/src/workflow/sw_bundle_workflow.py
+++ b/src/workflow/sw_bundle_workflow.py
@@ -72,7 +72,7 @@ class Define_Software(WorkflowStep):
host_profile = host.profile
break
excluded_images = Image.objects.exclude(owner=user).exclude(public=True)
- excluded_images = excluded_images | Image.objects.exclude(host_type=host.profile)
+ excluded_images = excluded_images | Image.objects.exclude(host_type=host_profile)
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"] = []
@@ -138,7 +138,7 @@ class Define_Software(WorkflowStep):
q.filter(host_type=host.profile)
q.filter(from_lab=lab)
q.get(id=image.id) # will throw exception if image is not in q
- except:
+ except Exception:
self.metastep.set_invalid("Image " + image.name + " is not compatible with host " + host.resource.name)
role = form.cleaned_data['role']
if "jumphost" in role.name.lower():
diff --git a/src/workflow/workflow_factory.py b/src/workflow/workflow_factory.py
index 1f4a28a..f5e2ad1 100644
--- a/src/workflow/workflow_factory.py
+++ b/src/workflow/workflow_factory.py
@@ -12,7 +12,7 @@ from workflow.booking_workflow import Booking_Resource_Select, SWConfig_Select,
from workflow.resource_bundle_workflow import Define_Hardware, Define_Nets, Resource_Meta_Info
from workflow.sw_bundle_workflow import Config_Software, Define_Software, SWConf_Resource_Select
from workflow.snapshot_workflow import Select_Host_Step, Image_Meta_Step
-from workflow.models import Repository, Confirmation_Step
+from workflow.models import Confirmation_Step
import uuid
@@ -35,6 +35,7 @@ class ConfigMetaWorkflow(object):
workflow_type = 2
color = "#00ffcc"
+
class MetaStep(object):
UNTOUCHED = 0
@@ -76,6 +77,7 @@ class MetaStep(object):
def __ne__(self, other):
return self.id.int != other.id.int
+
class Workflow(object):
def __init__(self, steps, metasteps, repository):
self.repository = repository
@@ -83,6 +85,7 @@ class Workflow(object):
self.metasteps = metasteps
self.active_index = 0
+
class WorkflowFactory():
booking_steps = [
Booking_Resource_Select,
diff --git a/src/workflow/workflow_manager.py b/src/workflow/workflow_manager.py
index 1d672cf..89a9d96 100644
--- a/src/workflow/workflow_manager.py
+++ b/src/workflow/workflow_manager.py
@@ -10,10 +10,8 @@
from django.http import JsonResponse
-import random
-
from booking.models import Booking
-from workflow.workflow_factory import WorkflowFactory, MetaStep
+from workflow.workflow_factory import WorkflowFactory
from workflow.models import Repository
from resource_inventory.models import (
GenericResourceBundle,
@@ -47,10 +45,15 @@ class SessionManager():
repo.set_defaults(defaults)
repo.el[repo.HAS_RESULT] = False
repo.el[repo.SESSION_USER] = self.owner
- self.workflows.append(self.factory.create_workflow(workflow_type=workflow_type, repo = repo))
+ self.workflows.append(
+ self.factory.create_workflow(
+ workflow_type=workflow_type,
+ repo=repo
+ )
+ )
def pop_workflow(self):
- if( len(self.workflows) <= 1 ):
+ if(len(self.workflows) <= 1):
return False
if self.workflows[-1].repository.el[self.workflows[-1].repository.HAS_RESULT]:
@@ -70,7 +73,7 @@ class SessionManager():
responsejson["active"] = self.active_workflow().repository.el['active_step']
responsejson["workflow_count"] = len(self.workflows)
return JsonResponse(responsejson, safe=False)
- except Exception as e:
+ except Exception:
pass
def render(self, request, **kwargs):