ranger-agent - fix pep8 errors

Fixes existing pep8 errors after initial commit.

Change-Id: Ic4741a9d090b87afed3a19cad62249637e0fbce3
This commit is contained in:
Michael Glaser 2017-08-08 14:24:01 -07:00
parent db8b5e0104
commit 2e01369ed9
16 changed files with 66 additions and 67 deletions

View File

@ -16,9 +16,9 @@
from ord.client import rpcapi
from ord.common import exceptions as exc
from ord.common import utils
from ord.i18n import _
from ord.common.utils import ErrorCode
from ord.db import api as db_api
from ord.i18n import _
from ord.openstack.common import log
from oslo_config import cfg
from pecan import expose
@ -203,13 +203,13 @@ class NotifierController(object):
msg = _("A valid request_id parameter is required")
raise webob.exc.HTTPBadRequest(explanation=msg)
# FIXME(db2242) we don't process this field. So why for it here?
# FIXME we don't process this field. So why for it here?
resource_type = vals.get('resource-type')
if resource_type is None:
msg = _("A valid resource_type parameter is required")
raise webob.exc.HTTPBadRequest(explanation=msg)
# FIXME(db2242): we support specific set of operation. We must check
# FIXME we support specific set of operation. We must check
# that received operation is in support list.
resource_operation = vals.get('operation')
if resource_operation is None:
@ -221,10 +221,10 @@ class NotifierController(object):
msg = _("A valid resource-template-name parameter is required")
raise webob.exc.HTTPBadRequest(explanation=msg)
# FIXME(db2242): why the hell we need it?
# FIXME: why is this needed?
template_version = vals.get('resource-template-version')
# FIXME(db2242): we can handle only 'hot' or 'ansible' values here
# FIXME: we can handle only 'hot' or 'ansible' values here
# Everything else must be rejected here.
template_type = vals.get('resource-template-type')
if template_type is None:

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from heatclient import client as heat
from glanceclient import client as glance
from heatclient import client as heat
from keystoneclient import discover as keystone_discover
from keystoneclient.v2_0 import client as keystone_v2
from keystoneclient.v3 import client as keystone_v3
@ -23,7 +23,7 @@ from oslo_config import cfg
from ord.openstack.common import log as logging
# FIXME(db2242): we definetly must change this group name. It very confusing.
# FIXME: we definetly must change this group name. It very confusing.
OPT_GROUP = cfg.OptGroup(name='ord_credentials', title='ORD Credentials')
SERVICE_OPTS = [
cfg.StrOpt('project_id', default='',

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import subprocess
import shlex
import ord.common.exceptions as excp
import os
import shlex
import subprocess
from oslo_config import cfg
from ord.openstack.common import log as logging
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -25,7 +25,7 @@ class HeatClient(object):
_kc = None
def __init__(self):
# FIXME(db2242): we must not cache any clients because it done(must
# FIXME: we must not cache any clients because it done(must
# be done) by "Clients"
try:
if HeatClient._kc is None:
@ -46,13 +46,13 @@ class HeatClient(object):
client, self._kc = Clients().heat(self._kc)
try:
payload = client.stacks.get(stack_id)
# TODO(db2242): check behaviour in case it object not exist
# TODO: check behaviour in case it object not exist
except heat_exc.BaseException as e:
raise exc.HEATIntegrationError(
action='stacks.get', details=e.message)
return payload
# TODO(db2242): check real heatclient capabilities to lookup objects
# TODO: check real heatclient capabilities to lookup objects
def get_stack_by_name(self, name):
for stack in self.get_stacks():
if stack.stack_name != name:

View File

@ -16,10 +16,10 @@
# limitations under the License.
import argparse
import json
import sys
import time
import uuid
import json
from werkzeug import exceptions as exc
from werkzeug import routing
@ -140,7 +140,7 @@ class _NotifierCatcher(_HandlerBase):
def _payload_from_form(self):
payload = dict(self.request.form)
# FIXME(db2242): ugly fix of incorrect data transfer from ORD-API
# FIXME: ugly fix of incorrect data transfer from ORD-API
if len(payload) != 1:
return payload

View File

@ -82,7 +82,7 @@ def cpu_count():
return 1
# FIXME(db2242): unused!
# FIXME: unused!
def update_nested(original_dict, updates):
"""Updates the leaf nodes in a nest dict.
@ -127,7 +127,6 @@ def create_rds_payload(template, template_target):
return payload
# FIXME(db2242): remove it
class ErrorCode(Enum):
ORD_NOERROR = ""

View File

@ -130,7 +130,7 @@ class WorkerFactory(object):
template_type):
template_type = template_type.lower()
# FIXME(db2242): this code have a none zero to fail in very unexpected
# FIXME: this code have a none zero to fail in very unexpected
# way
threadID = random.randint(0, 99999999)
if template_type == "hot":
@ -142,7 +142,7 @@ class WorkerFactory(object):
elif template_type == "ansible":
threadID = -1
else:
# FIXME(db2242): too late for such check
# FIXME: too late for such check
raise exc.UnsupportedTemplateTypeError(template=template_type)
return threadID

View File

@ -100,7 +100,7 @@ logging_cli_opts = [
'Existing syslog format is DEPRECATED during I, '
'and will change in J to honor RFC5424.'),
cfg.BoolOpt('use-syslog-rfc-format',
# TODO(bogdando) remove or use True after existing
# TODO() remove or use True after existing
# syslog format deprecation in J
default=False,
help='(Optional) Enables or disables syslog rfc5424 format '
@ -217,7 +217,7 @@ def _get_binary_name():
def _get_log_file_path(binary=None):
logfile = sys.argv[0].split('/')[-1]+'.log'
logfile = sys.argv[0].split('/')[-1] + '.log'
logdir = CONF.log_dir
if logfile and not logdir:
@ -549,7 +549,7 @@ def _setup_logging_from_conf(project, version):
if CONF.use_syslog:
try:
facility = _find_facility_from_conf()
# TODO(bogdando) use the format provided by RFCSysLogHandler
# TODO() use the format provided by RFCSysLogHandler
# after existing syslog format deprecation in J
if CONF.use_syslog_rfc_format:
syslog = RFCSysLogHandler(address='/dev/log',

View File

@ -16,12 +16,12 @@
"""
Unit Tests for ord.api.test_api
"""
from ord.tests import base
import mock
from mox import stubout
from ord.api.controllers.v1 import api
from ord.db import api as db_api
from ord.tests import base
from oslo_config import cfg
from mox import stubout
import mock
import requests
import urllib2
import webob
@ -240,25 +240,25 @@ class OrdApiTestCase(base.BaseTestCase):
ord_notifier = api.NotifierController()
request_id = {"Id": "2"}
db_template = {'resource_operation': 'create',
'resource_id': '1',
'region': 'local',
'template_type': 'hot',
'request_id': '2'}
'resource_id': '1',
'region': 'local',
'template_type': 'hot',
'request_id': '2'}
db_template_target = {'template_type': 'hot',
'status': 'Submitted',
'resource_name': 'image1',
'resource_operation': 'create',
'resource_template_version': '1',
'request_id': '2',
'region': 'local',
'ord-notifier-id': '1',
'resource_id': '1',
'resource_type': 'image',
'template_status_id': '1',
'template_version': '1',
'error_code': 'ORD_000',
'error_msg': 'stack fail'}
'status': 'Submitted',
'resource_name': 'image1',
'resource_operation': 'create',
'resource_template_version': '1',
'request_id': '2',
'region': 'local',
'ord-notifier-id': '1',
'resource_id': '1',
'resource_type': 'image',
'template_status_id': '1',
'template_version': '1',
'error_code': 'ORD_000',
'error_msg': 'stack fail'}
payload = {'rds-listener':
{'request-id': '2',

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import mock
from mock import patch
import os
from ord.tests import base
from ord.client import getrepo
from ord.common.exceptions import ORDException
from ord.tests import base
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -17,8 +17,8 @@
Unit Tests for ord.client.rpcapi
"""
import copy
from ord.tests import base
from ord.client import rpcapi
from ord.tests import base
from oslo_config import cfg
import stubout

View File

@ -17,8 +17,8 @@
Unit Tests for ord.client.rpcengine
"""
import copy
from ord.tests import base
from ord.client import rpcengine
from ord.tests import base
from oslo_config import cfg
import stubout

View File

@ -15,9 +15,9 @@
import mock
from ord.tests import base
from ord.engine.workerfactory import WorkerFactory
from ord.common.exceptions import WorkerThreadError
from ord.engine.workerfactory import WorkerFactory
from ord.tests import base
class TestWorkerFactory(base.BaseTestCase):
@ -44,9 +44,12 @@ class TestWorkerFactory(base.BaseTestCase):
self.worker = WorkerFactory()
def test_getWorker(self):
threadId = self.worker.getWorker(self.operation, self.path_to_tempate,
self.stack_name, self.template_status_id,
self.resource_type, self.template_type)
threadId = self.worker.getWorker(self.operation,
self.path_to_tempate,
self.stack_name,
self.template_status_id,
self.resource_type,
self.template_type)
assert (threadId > 0)
def test_negetive_removeWorker(self):
@ -55,11 +58,11 @@ class TestWorkerFactory(base.BaseTestCase):
def test_removeWorker(self):
localThreadId = self.worker.getWorker(self.operation,
self.path_to_tempate,
self.stack_name,
self.template_status_id,
self.resource_type,
self.template_type)
self.path_to_tempate,
self.stack_name,
self.template_status_id,
self.resource_type,
self.template_type)
try:
self.worker.removeWorker(localThreadId)
except Exception:

View File

@ -27,7 +27,6 @@ from ord.tests import base
CONF = cfg.CONF
# FIXME(db2242): pep8 compatible - camelcase attributes
class TestWorkerThread(base.BaseTestCase):
def setUp(self):
@ -83,9 +82,9 @@ class TestWorkerThread(base.BaseTestCase):
'resource-id': '1',
'resource-type': 'image',
'resource_extra_metadata':
{'checksum': 'dae557b1365b606e57fbd5d8c9d4516a',
'size': '10',
'virtual_size': '12'}}}
{'checksum': 'dae557b1365b606e57fbd5d8c9d4516a',
'size': '10',
'virtual_size': '12'}}}
self.heat_client.get_stack_by_name.return_value = stack
self.heat_client.get_image_data_by_stackid.return_value = image_data

View File

@ -118,8 +118,7 @@ class _Win32Colorizer(object):
'yellow': red | green | bold,
'magenta': red | blue | bold,
'cyan': green | blue | bold,
'white': red | green | blue | bold
}
'white': red | green | blue | bold}
def supported(cls, stream=sys.stdout):
try:

View File

@ -1,6 +1,7 @@
[tox]
minversion = 2.0
envlist = py34,py27,pypy,pep8
#Removed py34 & pypy until pep8 issues can be dealt with
envlist = py27,pep8
skipsdist = True
[testenv]
@ -33,9 +34,7 @@ commands =
commands = oslo_debug_helper {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,H405,H306,E901,E128,E226,F841,F841
ignore = H301,F821,H202,H101,H104,H238,H401,H405,E501,F811,F403,H233,F841
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build