Resolved PEP8 issues

Change-Id: Iffd5c6bab7789e20aecb8e011fe1860c37c9fe06
This commit is contained in:
Serg Melikyan 2013-10-10 13:11:41 +04:00
parent 929642dcd7
commit 45da1ffa6f
10 changed files with 38 additions and 15 deletions

View File

@ -32,6 +32,7 @@ import types
log = logging.getLogger(__name__)
format_version = '2.0.0'
class MuranoAgent(service.Service):
def __init__(self):
self._queue = ExecutionPlanQueue()
@ -42,8 +43,8 @@ class MuranoAgent(service.Service):
try:
log.debug('Loading plugin %s', name)
__import__(name)
except Exception, ex:
log.warn('Cannot load package %s', name, exc_info=1)
except Exception:
log.warn('Cannot load package %s', name, exc_info=True)
pass
def _load(self):

View File

@ -110,6 +110,3 @@ def setup_logging():
handler.setFormatter(formatter)
root_logger.addHandler(handler)

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
class AgentException(Exception):
def __init__(self, code, message=None, additional_data=None):
self._error_code = code
@ -32,4 +33,3 @@ class CustomException(AgentException):
def __init__(self, code, message=None, additional_data=None):
super(CustomException, self).__init__(
code + 100, message, additional_data)

View File

@ -82,5 +82,3 @@ class ExecutionPlanQueue(object):
def get_execution_plan_result(self):
return self._get_first_file(
ExecutionPlanQueue.result_filename)

View File

@ -67,7 +67,6 @@ class ApplicationExecutor(object):
raise muranoagent.exceptions.CustomException(
0,
message='Script {0} returned error code'.format(self._name),
additional_data= result)
additional_data=result)
return Bunch(result)

View File

@ -40,7 +40,7 @@ class FilesManager(object):
filedef = self._files[file_id]
filename = filedef['Name']
file_folder = os.path.join(script_folder, os.path.dirname(filename))
file_folder = os.path.join(script_folder, os.path.dirname(filename))
if not os.path.exists(file_folder):
os.makedirs(file_folder)

View File

@ -104,8 +104,7 @@ def _listen(host, start_port, end_port, listen_func):
try:
return listen_func((host, try_port))
except socket.error as exc:
if (exc.errno != errno.EADDRINUSE or
try_port >= end_port):
if (exc.errno != errno.EADDRINUSE or try_port >= end_port):
raise
try_port += 1

View File

@ -0,0 +1,13 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -2,8 +2,6 @@
name = murano-agent
version = 0.3
summary = Python Murano Agent
description-file =
README.rst
license = Apache License, Version 2.0
author = Mirantis, Inc.
author-email = murano-all@lists.openstack.org

View File

@ -0,0 +1,18 @@
# Needed for testing
unittest2
coverage>=3.6
fixtures>=0.3.14
mox>=0.5.3
nose
nose-exclude
openstack.nose_plugin>=0.7
nosehtmloutput>=0.0.3
pep8==1.3.3
sphinx>=1.1.2
requests>=1.1
testtools>=0.9.32
mock>=1.0
# Optional packages that should be installed when testing
xattr>=0.4
pysendfile==2.0.0