make pep8 happy

Change-Id: I4ef5583432cc4f9c1aeb095bcd37bc31cc82aa75
This commit is contained in:
German Eichberger 2014-04-01 10:14:50 -07:00
parent f0bdbb4cd9
commit 2300c8952a
15 changed files with 26 additions and 30 deletions

View File

@ -74,8 +74,7 @@ class DevicesController(RestController):
lbids = session.query(
loadbalancers_devices.c.loadbalancer).\
filter(
loadbalancers_devices.c.device == dev['id']
).\
loadbalancers_devices.c.device == dev['id']).\
all()
lblist = [i[0] for i in lbids]
@ -118,8 +117,7 @@ class DevicesController(RestController):
lbids = session.query(
loadbalancers_devices.c.loadbalancer).\
filter(
loadbalancers_devices.c.device == device['id']
).\
loadbalancers_devices.c.device == device['id']).\
all()
lblist = [i[0] for i in lbids]
@ -182,7 +180,7 @@ class DevicesController(RestController):
session.add(device)
session.flush()
#refresh the device record so we get the id back
# refresh the device record so we get the id back
session.refresh(device)
try:

View File

@ -138,8 +138,7 @@ class DevicesController(RestController):
lbids = session.query(
loadbalancers_devices.c.loadbalancer).\
filter(
loadbalancers_devices.c.device == device['id']
).\
loadbalancers_devices.c.device == device['id']).\
all()
lblist = [i[0] for i in lbids]

View File

@ -25,7 +25,7 @@ from libra.common.api.lbaas import Counters
from libra.common.json_gearman import JSONGearmanClient
from libra.openstack.common import log
#TODO: Lots of duplication of code here, need to cleanup
# TODO: Lots of duplication of code here, need to cleanup
LOG = log.getLogger(__name__)

View File

@ -107,7 +107,7 @@ class BillingStats(object):
session.rollback()
return
#Update the exists timestamp now
# Update the exists timestamp now
session.query(Billing).\
filter(Billing.name == "exists").\
update({"last_update": func.now()},

View File

@ -193,8 +193,7 @@ class PingStats(object):
format(
node_data.lbid,
data.floatingIpAddr,
data.tenantid
)
data.tenantid)
# Change the node status in the node table
session.query(Node).\

View File

@ -188,7 +188,7 @@ class GearJobs(object):
# Error returned by Gearman
failed_list.append(stats.job.task)
else:
#Success
# Success
results[stats.job.task] = stats.result
list_of_jobs = []
@ -218,7 +218,7 @@ class GearJobs(object):
# Error returned by Gearman
failed_list.append(stats.job.task)
else:
#Success
# Success
results[stats.job.task] = stats.result
return failed_list, results

View File

@ -82,7 +82,7 @@ class UsageStats(object):
session.rollback()
return 0, 0
#Update the stats timestamp
# Update the stats timestamp
session.query(Billing).\
filter(Billing.name == "stats").\
update({"last_update": func.now()},

View File

@ -523,7 +523,7 @@ class LoadBalancersController(RestController):
# write to database
session.add(lb)
session.flush()
#refresh the lb record so we get the id back
# refresh the lb record so we get the id back
session.refresh(lb)
for node in body.nodes:
if node.condition == 'DISABLED':

View File

@ -18,7 +18,7 @@ from pecan.rest import RestController
import wsmeext.pecan as wsme_pecan
from wsme.exc import ClientSideError
from wsme import Unset
#default response objects
# default response objects
from libra.common.api.lbaas import LoadBalancer, Node, db_session, Limits
from libra.common.api.lbaas import Device, Counters
from libra.api.acl import get_limited_to_project

View File

@ -40,7 +40,7 @@ class V1Controller(object):
response.status = 200
return Responses.algorithms
#pecan uses this controller class for urls that start with /loadbalancers
# pecan uses this controller class for urls that start with /loadbalancers
loadbalancers = LoadBalancersController()
limits = LimitsController()
protocols = ProtocolsController()

View File

@ -322,7 +322,7 @@ class GearmanClientThread(object):
counter.value += 1
session.commit()
#Notify billing of the LB deletion
# Notify billing of the LB deletion
update_mnb('lbaas.instance.delete', self.lbid, tenant_id)
def _set_error(self, device_id, errmsg, session):

View File

@ -88,7 +88,7 @@ class Vip(DeclarativeBase):
class Device(DeclarativeBase):
"""device model"""
__tablename__ = 'devices'
#column definitions
# column definitions
az = Column(u'az', INTEGER(), nullable=False)
created = Column(u'created', FormatedDateTime(), nullable=False)
floatingIpAddr = Column(
@ -107,7 +107,7 @@ class Device(DeclarativeBase):
class LoadBalancer(DeclarativeBase):
"""load balancer model"""
__tablename__ = 'loadbalancers'
#column definitions
# column definitions
algorithm = Column(u'algorithm', VARCHAR(length=80), nullable=False)
errmsg = Column(u'errmsg', VARCHAR(length=128), nullable=True)
id = Column(u'id', BIGINT(), primary_key=True, nullable=False)
@ -137,7 +137,7 @@ class LoadBalancer(DeclarativeBase):
class Node(DeclarativeBase):
"""node model"""
__tablename__ = 'nodes'
#column definitions
# column definitions
address = Column(u'address', VARCHAR(length=128), nullable=False)
enabled = Column(u'enabled', INTEGER(), nullable=False)
id = Column(u'id', BIGINT(), primary_key=True, nullable=False)
@ -153,7 +153,7 @@ class Node(DeclarativeBase):
class HealthMonitor(DeclarativeBase):
"""monitors model"""
__tablename__ = 'monitors'
#column definitions
# column definitions
lbid = Column(
u'lbid', BIGINT(), ForeignKey('loadbalancers.id'), primary_key=True,
nullable=False
@ -177,7 +177,7 @@ class Billing(DeclarativeBase):
class Stats(DeclarativeBase):
"""stats model"""
__tablename__ = 'stats'
#column definitions
# column definitions
id = Column(u'id', BIGINT(), primary_key=True, nullable=False)
lbid = Column(
u'lbid', BIGINT(), ForeignKey('loadbalancers.id'), primary_key=True,
@ -192,7 +192,7 @@ class Stats(DeclarativeBase):
class Ports(DeclarativeBase):
"""ports model"""
__tablename__ = 'ports'
#column definitions
# column definitions
id = Column(u'id', BIGINT(), primary_key=True, nullable=False)
protocol = Column(u'protocol', VARCHAR(length=50), nullable=False)
portnum = Column(u'portnum', BIGINT(), nullable=False)

View File

@ -310,7 +310,7 @@ def _send_test(event_type, lbid, tenant_id):
LOG.info("Aborting test Notifications. Could not connect")
return
#Note lbid is the number of notifications to send
# Note lbid is the number of notifications to send
lbid += 1
for x in xrange(1, lbid):
payload = _build_payload(now, now, "Test LB", str(x),

View File

@ -31,7 +31,7 @@ def get_descriptors():
descriptors = []
def _add(fh):
if not fh in descriptors:
if fh not in descriptors:
descriptors.append(fh)
for logger in log._loggers.values():

View File

@ -82,9 +82,9 @@ class HAProxyDriver(LoadBalancerDriver):
if proto == 'galera':
real_proto = 'tcp'
#------------------------
# ------------------------
# Frontend configuration
#------------------------
# ------------------------
output.append('frontend %s-in' % real_proto)
output.append(' mode %s' % real_proto)
output.append(' bind %s:%s' % (protocfg['bind_address'],
@ -100,9 +100,9 @@ class HAProxyDriver(LoadBalancerDriver):
elif real_proto == 'tcp':
output.append(' option tcplog')
#------------------------
# ------------------------
# Backend configuration
#------------------------
# ------------------------
output.append('backend %s-servers' % real_proto)
output.append(' mode %s' % real_proto)