diff --git a/murano/api/v1/__init__.py b/murano/api/v1/__init__.py index 88ab3341..42c5ab30 100644 --- a/murano/api/v1/__init__.py +++ b/murano/api/v1/__init__.py @@ -62,9 +62,9 @@ def get_service_status(environment_id, session_id, service): entities = [u['id'] for u in service['units']] reports_count = unit.query(models.Status).filter( - models.Status.environment_id == environment_id - and models.Status.session_id == session_id - and models.Status.entity_id.in_(entities) + models.Status.environment_id == environment_id and + models.Status.session_id == session_id and + models.Status.entity_id.in_(entities) ).count() if session_state == 'deployed': diff --git a/murano/cmd/api.py b/murano/cmd/api.py index 23a41ee6..ee365668 100644 --- a/murano/cmd/api.py +++ b/murano/cmd/api.py @@ -20,19 +20,6 @@ import sys import eventlet -if os.name == 'nt': - # eventlet monkey patching causes subprocess.Popen to fail on Windows - # when using pipes due to missing non blocking I/O support - eventlet.monkey_patch(os=False) -else: - eventlet.monkey_patch() - -# If ../murano/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir) -if os.path.exists(os.path.join(root, 'murano', '__init__.py')): - sys.path.insert(0, root) - from oslo_config import cfg from oslo_log import log as logging from oslo_service import service @@ -48,6 +35,20 @@ from murano.common import wsgi CONF = cfg.CONF +if os.name == 'nt': + # eventlet monkey patching causes subprocess.Popen to fail on Windows + # when using pipes due to missing non blocking I/O support + eventlet.monkey_patch(os=False) +else: + eventlet.monkey_patch() + +# If ../murano/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir) +if os.path.exists(os.path.join(root, 'murano', '__init__.py')): + sys.path.insert(0, root) + + def main(): try: config.parse_args() diff --git a/murano/cmd/cfapi.py b/murano/cmd/cfapi.py index d864b99b..8320c7dc 100644 --- a/murano/cmd/cfapi.py +++ b/murano/cmd/cfapi.py @@ -20,19 +20,6 @@ import sys import eventlet -if os.name == 'nt': - # eventlet monkey patching causes subprocess.Popen to fail on Windows - # when using pipes due to missing non blocking I/O support - eventlet.monkey_patch(os=False) -else: - eventlet.monkey_patch() - -# If ../murano/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir) -if os.path.exists(os.path.join(root, 'murano', '__init__.py')): - sys.path.insert(0, root) - from oslo_config import cfg from oslo_log import log as logging from oslo_service import service @@ -47,6 +34,20 @@ from murano.common import wsgi CONF = cfg.CONF +if os.name == 'nt': + # eventlet monkey patching causes subprocess.Popen to fail on Windows + # when using pipes due to missing non blocking I/O support + eventlet.monkey_patch(os=False) +else: + eventlet.monkey_patch() + +# If ../murano/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir) +if os.path.exists(os.path.join(root, 'murano', '__init__.py')): + sys.path.insert(0, root) + + def main(): try: config.parse_args() diff --git a/murano/cmd/engine.py b/murano/cmd/engine.py index 6d45dd12..0e4400f2 100644 --- a/murano/cmd/engine.py +++ b/murano/cmd/engine.py @@ -19,6 +19,14 @@ import sys import eventlet +from oslo_log import log as logging +from oslo_service import service + +from murano.common import config +from murano.common import engine + +CONF = config.CONF + if os.name == 'nt': # eventlet monkey patching causes subprocess.Popen to fail on Windows @@ -33,14 +41,6 @@ root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir) if os.path.exists(os.path.join(root, 'murano', '__init__.py')): sys.path.insert(0, root) -from oslo_log import log as logging -from oslo_service import service - -from murano.common import config -from murano.common import engine - -CONF = config.CONF - def main(): try: diff --git a/murano/common/engine.py b/murano/common/engine.py index a36f5b51..e5230218 100755 --- a/murano/common/engine.py +++ b/murano/common/engine.py @@ -148,8 +148,8 @@ class TaskExecutor(object): self._model['SystemData'] = self._environment.system_attributes result['model'] = self._model - if (not self._model.get('Objects') - and not self._model.get('ObjectsCopy')): + if (not self._model.get('Objects') and + not self._model.get('ObjectsCopy')): try: self._delete_trust() except Exception: diff --git a/murano/common/messaging/mqclient.py b/murano/common/messaging/mqclient.py index 1813dda7..2a446584 100644 --- a/murano/common/messaging/mqclient.py +++ b/murano/common/messaging/mqclient.py @@ -16,10 +16,11 @@ import ssl as ssl_module from eventlet import patcher -kombu = patcher.import_patched('kombu') from oslo_serialization import jsonutils from subscription import Subscription +kombu = patcher.import_patched('kombu') + class MqClient(object): def __init__(self, login, password, host, port, virtual_host, diff --git a/murano/common/messaging/subscription.py b/murano/common/messaging/subscription.py index 10689f57..005db3f5 100644 --- a/murano/common/messaging/subscription.py +++ b/murano/common/messaging/subscription.py @@ -18,9 +18,10 @@ import socket import time from eventlet import patcher -kombu = patcher.import_patched('kombu') from murano.common.messaging import message +kombu = patcher.import_patched('kombu') + class Subscription(object): def __init__(self, connection, queue, prefetch_count=1): diff --git a/murano/common/utils.py b/murano/common/utils.py index 7b2eede5..be95a66d 100644 --- a/murano/common/utils.py +++ b/murano/common/utils.py @@ -166,8 +166,8 @@ def is_different(obj1, obj2): if o1 is o2: return - elif (isinstance(o1, basestring) - and isinstance(o2, basestring)) and o1 == o2: + elif (isinstance(o1, basestring) and + isinstance(o2, basestring)) and o1 == o2: return elif type(o1) != type(o2): raise Difference() diff --git a/murano/common/wsgi.py b/murano/common/wsgi.py index d127fbe3..9ccd6b54 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -25,7 +25,6 @@ from xml.dom import minidom from xml.parsers import expat import eventlet -eventlet.patcher.monkey_patch(all=False, socket=True) import eventlet.wsgi import jsonschema from oslo_config import cfg @@ -44,6 +43,8 @@ from murano.common import exceptions from murano.common.i18n import _, _LE, _LW from murano.common import xmlutils +eventlet.patcher.monkey_patch(all=False, socket=True) + wsgi_opts = [ cfg.IntOpt('backlog', default=4096, diff --git a/murano/dsl/executor.py b/murano/dsl/executor.py index 0dc165a8..4a7c6ad3 100644 --- a/murano/dsl/executor.py +++ b/murano/dsl/executor.py @@ -107,8 +107,8 @@ class MuranoDslExecutor(object): return (None if method.body is None else method.body.execute(context)) - if (not isinstance(method.body, specs.FunctionDefinition) - or not method.body.meta.get(constants.META_NO_TRACE)): + if (not isinstance(method.body, specs.FunctionDefinition) or + not method.body.meta.get(constants.META_NO_TRACE)): with self._log_method(context, args, kwargs) as log: result = call() log(result) diff --git a/murano/dsl/murano_method.py b/murano/dsl/murano_method.py index 4f8c1abb..7a004825 100644 --- a/murano/dsl/murano_method.py +++ b/murano/dsl/murano_method.py @@ -50,8 +50,8 @@ class MuranoMethod(dsl_types.MuranoMethod): self._usage = (self._body.meta.get('usage') or self._body.meta.get('Usage') or MethodUsages.Runtime) - if (self._body.name.startswith('#') - or self._body.name.startswith('*')): + if (self._body.name.startswith('#') or + self._body.name.startswith('*')): raise ValueError( 'Import of special yaql functions is forbidden') else: @@ -64,8 +64,8 @@ class MuranoMethod(dsl_types.MuranoMethod): arguments_scheme.iteritems()] self._arguments_scheme = collections.OrderedDict() for record in arguments_scheme: - if (not isinstance(record, types.DictionaryType) - or len(record) > 1): + if (not isinstance(record, types.DictionaryType) or + len(record) > 1): raise ValueError() name = record.keys()[0] self._arguments_scheme[name] = typespec.ArgumentSpec( diff --git a/murano/dsl/murano_object.py b/murano/dsl/murano_object.py index 62f60b29..02e63de9 100644 --- a/murano/dsl/murano_object.py +++ b/murano/dsl/murano_object.py @@ -201,10 +201,10 @@ class MuranoObject(dsl_types.MuranoObject): values_to_assign = [] for mc in declared_properties: spec = mc.get_property(name) - if (caller_class is not None and - not helpers.are_property_modifications_allowed(context) - and (spec.usage not in typespec.PropertyUsages.Writable - or not derived)): + if (caller_class is not None and not + helpers.are_property_modifications_allowed(context) and + (spec.usage not in typespec.PropertyUsages.Writable or + not derived)): raise exceptions.NoWriteAccessError(name) default = self.__config.get(name, spec.default) diff --git a/murano/dsl/serializer.py b/murano/dsl/serializer.py index aa267bb7..80827594 100644 --- a/murano/dsl/serializer.py +++ b/murano/dsl/serializer.py @@ -93,8 +93,8 @@ def _pass12_serialize(value, parent, serialized_objects, if value.owner is not parent or value.object_id in serialized_objects: return ObjRef(value), True elif isinstance(value, ObjRef): - if (value.ref_obj.object_id not in serialized_objects - and is_nested_in(value.ref_obj.owner, parent)): + if (value.ref_obj.object_id not in serialized_objects and + is_nested_in(value.ref_obj.owner, parent)): value = value.ref_obj else: return value, False @@ -139,8 +139,8 @@ def _pass3_serialize(value, serialized_objects, allow_refs=False): if isinstance(value, dict): for d_key, d_value in value.items(): if isinstance(d_value, ObjRef): - if (d_value.ref_obj.object_id in serialized_objects - or allow_refs): + if (d_value.ref_obj.object_id in serialized_objects or + allow_refs): value[d_key] = d_value.ref_obj.object_id else: del value[d_key] diff --git a/murano/policy/modify/actions/default_actions.py b/murano/policy/modify/actions/default_actions.py index 14475ade..7672e2e8 100644 --- a/murano/policy/modify/actions/default_actions.py +++ b/murano/policy/modify/actions/default_actions.py @@ -91,8 +91,8 @@ class RemoveObjectAction(base.ModifyActionBase, ActionUtils): # remove object from dict elif isinstance(val, utils.FrozenDict): filtered_dict = {k: v for k, v in val.items() if not - self._match_object_id(self._object_id, k) - and not + self._match_object_id(self._object_id, + k) and not self._match_object_id(self._object_id, v)} if len(filtered_dict) < len(val): _obj.set_property(prop_name,