Commit 31297241 authored by Daniele Venzano's avatar Daniele Venzano

Small cleanups requires to pass stricter tests

parent 35e6edba
......@@ -2,6 +2,6 @@
set -e
pylint *.py zoe_*
pylint --ignore old_swarm *.py zoe_*
doc8 docs/
......@@ -34,7 +34,7 @@ class ExecutionAPI(RequestHandler):
"""Set up the headers for enabling CORS."""
manage_cors_headers(self)
def options(self, execution_id):
def options(self, execution_id_):
"""Needed for CORS."""
self.set_status(204)
self.finish()
......
......@@ -40,7 +40,7 @@ class ServiceAPI(RequestHandler):
manage_cors_headers(self)
@catch_exceptions
def options(self, service_id):
def options(self, service_id_):
"""Needed for CORS."""
self.set_status(204)
self.finish()
......
......@@ -64,7 +64,10 @@ class ZAppPackage:
fpath = os.path.join(self.load_path, self.METADATA_FILE)
schema = json.load(open(METADATA_SCHEMA_PATH, 'r'))
metadata = json.load(open(fpath, 'r'))
json_schema_validate(metadata, schema)
try:
json_schema_validate(metadata, schema)
except ValidationError as e:
raise ZoeException(str(e))
# Code for handling previous package versions goes here
self.package_version = metadata['package_version']
......
......@@ -42,10 +42,10 @@ class ZAppStorage:
return all_zapps
def load(self, id):
def load(self, zapp_id):
"""Loads a specific ZApp given its ID."""
zapps = self.list()
for zapp in zapps:
if zapp.id == id:
if zapp.id == zapp_id:
return zapp
return None
......@@ -15,7 +15,7 @@
"""The base class that all backends should implement."""
from zoe_lib.state import Execution, Service
from zoe_lib.state import Service
from zoe_master.stats import ClusterStats
from zoe_master.backends.service_instance import ServiceInstance
......
......@@ -31,7 +31,6 @@ try:
except ImportError:
KazooClient = None
AVAILABLE = True
try:
import docker
import docker.errors
......@@ -41,16 +40,17 @@ except ImportError:
else:
try:
docker.DockerClient()
except:
AVAILABLE = True
except AttributeError:
AVAILABLE = False
import requests.packages
from zoe_lib.config import get_conf
from zoe_lib.exceptions import ZoeLibException, ZoeNotEnoughResourcesException
from zoe_lib.state import Service
from zoe_master.stats import ClusterStats, NodeStats
from zoe_master.backends.service_instance import ServiceInstance
from zoe_lib.state import Service
log = logging.getLogger(__name__)
......
......@@ -29,7 +29,6 @@ from zoe_master.stats import NodeStats, ClusterStats # pylint: disable=unused-i
log = logging.getLogger(__name__)
# These two module-level variables hold the references to the monitor and checker threads
_monitor = None
_checker = None
......@@ -42,7 +41,7 @@ class OldSwarmNewAPIBackend(zoe_master.backends.base.BaseBackend):
@classmethod
def init(cls, state):
"""Initializes Swarm backend starting the event monitoring thread."""
global _monitor, _checker
global _checker
_checker = SwarmStateSynchronizer(state)
@classmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment