Address pep8 issues
This commit is contained in:
parent
215674d542
commit
0a6ff6f0a3
|
@ -190,6 +190,7 @@ class ActionDispatcher(object):
|
|||
def default(self, data):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class TextDeserializer(ActionDispatcher):
|
||||
"""Default request body deserialization."""
|
||||
|
||||
|
@ -199,6 +200,7 @@ class TextDeserializer(ActionDispatcher):
|
|||
def default(self, datastring):
|
||||
return {}
|
||||
|
||||
|
||||
class JSONDeserializer(TextDeserializer):
|
||||
|
||||
def _from_json(self, datastring):
|
||||
|
@ -211,6 +213,7 @@ class JSONDeserializer(TextDeserializer):
|
|||
def default(self, datastring):
|
||||
return {'body': self._from_json(datastring)}
|
||||
|
||||
|
||||
class DictSerializer(ActionDispatcher):
|
||||
"""Default request body serialization."""
|
||||
|
||||
|
@ -227,6 +230,7 @@ class JSONDictSerializer(DictSerializer):
|
|||
def default(self, data):
|
||||
return jsonutils.dump_as_bytes(data)
|
||||
|
||||
|
||||
def action_peek_json(body):
|
||||
"""Determine action to invoke."""
|
||||
|
||||
|
@ -244,6 +248,7 @@ def action_peek_json(body):
|
|||
# Return the action and the decoded body...
|
||||
return list(decoded.keys())[0]
|
||||
|
||||
|
||||
class ResponseObject(object):
|
||||
"""Bundles a response object with appropriate serializers.
|
||||
|
||||
|
@ -283,6 +288,7 @@ class ResponseObject(object):
|
|||
"""Deletes the header with the given name."""
|
||||
|
||||
del self._headers[key.lower()]
|
||||
|
||||
def _bind_method_serializers(self, meth_serializers):
|
||||
"""Binds method serializers with the response object.
|
||||
|
||||
|
@ -413,7 +419,6 @@ class ResourceExceptionHandler(object):
|
|||
LOG.info("HTTP exception thrown: %s", six.text_type(ex_value))
|
||||
raise Fault(ex_value)
|
||||
LOG.info("HTTP exception thrown: %s", six.text_type(ex_value))
|
||||
#raise Fault("something bad happened")
|
||||
|
||||
# We didn't handle the exception
|
||||
return False
|
||||
|
|
|
@ -27,10 +27,11 @@ class Cache(object):
|
|||
|
||||
def _getconn(self):
|
||||
self.conn = sqlite3.connect('test.db')
|
||||
|
||||
|
||||
def add(self, id, data):
|
||||
self._getconn()
|
||||
s = ("INSERT INTO cache (id, data) VALUES (\'{id}\', \'{data}\')".format(id=id, data=data));
|
||||
s = ("INSERT INTO cache (id, data) VALUES (\'{id}\', \'{data}\')"
|
||||
.format(id=id, data=data))
|
||||
self.conn.execute(s)
|
||||
self.conn.commit()
|
||||
self.conn.close()
|
||||
|
@ -38,7 +39,8 @@ class Cache(object):
|
|||
def get(self, id):
|
||||
data = None
|
||||
self._getconn()
|
||||
cursor = self.conn.execute("SELECT id, data from cache where id=\'%s\'" % id)
|
||||
cursor = self.conn.execute("SELECT id, data from cache where "
|
||||
"id=\'%s\'" % id)
|
||||
for row in cursor:
|
||||
data = row[1]
|
||||
self.conn.close()
|
||||
|
|
|
@ -45,18 +45,6 @@ service_opts = [
|
|||
]
|
||||
|
||||
|
||||
#CONF = cfg.ConfigOpts()
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(service_opts)
|
||||
log.register_options(CONF)
|
||||
|
||||
# CONF(sys.argv[1:], project='join', version='1.0.0')
|
||||
# log.setup(CONF, 'join')
|
||||
# launcher = process_launcher()
|
||||
# server = WSGIService('join')
|
||||
# launcher.launch_service(server, workers=server.workers)
|
||||
# launcher.wait()
|
||||
#
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
|
|
@ -27,7 +27,6 @@ from webob.util import status_generic_reasons
|
|||
from webob.util import status_reasons
|
||||
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -113,6 +112,7 @@ class NotAuthorized(JoinException):
|
|||
message = "Not authorized."
|
||||
code = 403
|
||||
|
||||
|
||||
class Invalid(JoinException):
|
||||
message = "Unacceptable parameters."
|
||||
code = 400
|
||||
|
|
|
@ -33,13 +33,14 @@ CONF = config.CONF
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class NotificationEndpoint(object):
|
||||
|
||||
filter_rule = oslo_messaging.notify.filter.NotificationFilter(
|
||||
publisher_id='^compute.*|^network.*',
|
||||
event_type='^compute.instance.create.end|' \
|
||||
'^compute.instance.delete.end|' \
|
||||
'^network.floating_ip.(dis)?associate',)
|
||||
publisher_id='^compute.*|^network.*',
|
||||
event_type='^compute.instance.create.end|'
|
||||
'^compute.instance.delete.end|'
|
||||
'^network.floating_ip.(dis)?associate',)
|
||||
|
||||
def __init__(self):
|
||||
self.uuidcache = cache.Cache()
|
||||
|
@ -95,10 +96,11 @@ def main():
|
|||
logging.setup(CONF, 'join')
|
||||
|
||||
transport = oslo_messaging.get_transport(CONF)
|
||||
targets = [ oslo_messaging.Target(topic='notifications') ]
|
||||
endpoints = [ NotificationEndpoint() ]
|
||||
targets = [oslo_messaging.Target(topic='notifications')]
|
||||
endpoints = [NotificationEndpoint()]
|
||||
|
||||
server = oslo_messaging.get_notification_listener(transport, targets, endpoints)
|
||||
server = oslo_messaging.get_notification_listener(transport, targets,
|
||||
endpoints)
|
||||
LOG.info("Starting")
|
||||
server.start()
|
||||
try:
|
||||
|
|
|
@ -144,7 +144,7 @@ def install(args):
|
|||
|
||||
confopts = {'FQDN': args['hostname'],
|
||||
'MASTER': api.env.server, # pylint: disable=no-member
|
||||
'DOMAIN': api.env.domain,} # pylint: disable=no-member
|
||||
'DOMAIN': api.env.domain} # pylint: disable=no-member
|
||||
|
||||
write_from_template(JOINCONF,
|
||||
os.path.join(DATADIR, 'join.conf.template'),
|
||||
|
@ -227,8 +227,8 @@ def parse_args():
|
|||
% e)
|
||||
if not args['password']:
|
||||
try:
|
||||
args['password'] = getpass.getpass("Password for %s: " %
|
||||
args['principal'])
|
||||
args['password'] = getpass.getpass("Password for %s: " %
|
||||
args['principal'])
|
||||
except EOFError:
|
||||
password = None
|
||||
if not args['password']:
|
||||
|
|
Loading…
Reference in New Issue