Switch to flake8 for style checks and make fixes
Change tox.ini to use flake8 for static analysis checks and then fix the issues that it finds. Change-Id: I829126a4462ab7ee79959996313eb3c94495d482 Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
parent
261d50a3a6
commit
aebf0decd5
|
@ -1,6 +1,5 @@
|
|||
import httplib2
|
||||
import json
|
||||
import netaddr
|
||||
|
||||
from akanda.rug.openstack.common import jsonutils
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import logging
|
||||
import re
|
||||
|
||||
import netaddr
|
||||
from oslo.config import cfg
|
||||
|
||||
from akanda.rug.openstack.common import jsonutils
|
||||
|
@ -71,7 +70,6 @@ def generate_network_config(client, router, interfaces):
|
|||
def _management_network_config(port, ifname, interfaces):
|
||||
for iface in interfaces:
|
||||
if iface['ifname'] == ifname:
|
||||
interface = iface
|
||||
return _make_network_config_dict(
|
||||
iface, MANAGEMENT_NET, port.network_id)
|
||||
|
||||
|
@ -161,7 +159,7 @@ def generate_anchor_config(client, provider_rules, router):
|
|||
|
||||
|
||||
def generate_tenant_port_forward_anchor(client, router):
|
||||
to_ip = router.external_port.first_v4 or INVALID_IP
|
||||
to_ip = router.external_port.first_v4 or '127.0.0.1'
|
||||
|
||||
rules = [_format_port_forward_rule(to_ip, pf)
|
||||
for pf in client.get_portforwards(router.tenant_id)]
|
||||
|
@ -173,7 +171,7 @@ def generate_tenant_port_forward_anchor(client, router):
|
|||
|
||||
|
||||
def _format_port_forward_rule(to_ip, pf):
|
||||
redirect_ip = pf.port.first_v4 or INVALID_IP
|
||||
redirect_ip = pf.port.first_v4
|
||||
|
||||
if not redirect_ip:
|
||||
return
|
||||
|
|
|
@ -18,7 +18,7 @@ class Nova(object):
|
|||
nics = [{'net-id': p.network_id, 'v4-fixed-ip': '', 'port-id': p.id}
|
||||
for p in ports]
|
||||
|
||||
server = self.client.servers.create(
|
||||
self.client.servers.create(
|
||||
'ak-' + router.id,
|
||||
image=self.conf.router_image_uuid,
|
||||
flavor=self.conf.router_instance_flavor,
|
||||
|
|
|
@ -23,7 +23,7 @@ from oslo.config import cfg
|
|||
from akanda.rug.common.linux import ip_lib
|
||||
from akanda.rug.common.linux import ovs_lib
|
||||
from akanda.rug.common.linux import utils
|
||||
from akanda.rug.openstack.common import importutils
|
||||
from akanda.rug.openstack.common.gettextutils import _
|
||||
from akanda.rug.openstack.common import log as logging
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import netaddr
|
||||
|
||||
from akanda.rug.common.linux import utils
|
||||
from akanda.rug.openstack.common.gettextutils import _
|
||||
|
||||
|
||||
LOOPBACK_DEVNAME = 'lo'
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
import re
|
||||
|
||||
from akanda.rug.common.linux import utils
|
||||
from akanda.rug.openstack.common.gettextutils import _
|
||||
from akanda.rug.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -27,6 +27,7 @@ import tempfile
|
|||
|
||||
from eventlet.green import subprocess
|
||||
|
||||
from akanda.rug.openstack.common.gettextutils import _
|
||||
from akanda.rug.openstack.common import log as logging
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class NotificationMixin(object):
|
|||
msg['_context_tenant_id'],
|
||||
msg['payload'])
|
||||
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
LOG.exception('Error processing notification.')
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ cfg.CONF.register_opts(AGENT_OPTIONS, 'AGENT')
|
|||
# How many licks does it take to get to the center of a Tootsie pop?
|
||||
MAGIC_MAX_RETRIES = 3
|
||||
|
||||
|
||||
def wait_for_callable(f, error_msg, max_sleep=15,
|
||||
ignorable_exceptions=(Exception,)):
|
||||
"""Wait for a callable to return without exception.
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
import urlparse
|
||||
|
||||
import eventlet
|
||||
|
@ -64,7 +62,7 @@ class MetadataProxyHandler(object):
|
|||
else:
|
||||
return webob.exc.HTTPNotFound()
|
||||
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
LOG.exception("Unexpected error.")
|
||||
msg = ('An unknown error has occurred. '
|
||||
'Please try your request again.')
|
||||
|
|
|
@ -5,8 +5,8 @@ import eventlet
|
|||
from oslo.config import cfg
|
||||
|
||||
from akanda.rug import manager
|
||||
from akanda.rug.openstack.common.gettextutils import _
|
||||
from akanda.rug.openstack.common import log
|
||||
from akanda.rug.openstack.common import rpc
|
||||
from akanda.rug.openstack.common.rpc import service as rpc_service
|
||||
from akanda.rug.openstack.common import service
|
||||
|
||||
|
|
8
tox.ini
8
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py27,pep8
|
||||
envlist = py27,style
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
|
@ -9,10 +9,10 @@ sitepackages = False
|
|||
|
||||
[tox:jenkins]
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8
|
||||
[testenv:style]
|
||||
deps = flake8
|
||||
setuptools_git>=0.4
|
||||
commands = pep8 --repeat --show-source --ignore=E125 --exclude=.venv,.tox,dist,doc,*egg .
|
||||
commands = flake8 akanda setup.py
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
|
Loading…
Reference in New Issue