Added gitignore and re-fixed pep8 violations.

This commit is contained in:
Tim Simpson 2012-03-07 16:33:58 -06:00
parent 20c8c3e105
commit f5665b005c
9 changed files with 17 additions and 13 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ reddwarf_test.sqlite
.venv .venv
run_tests.log run_tests.log
guest-agent-files.txt guest-agent-files.txt
reddwarf.egg*
reddwarf/vcsversion.py

View File

@ -46,7 +46,8 @@ if __name__ == '__main__':
(options, args) = config.parse_options(parser) (options, args) = config.parse_options(parser)
try: try:
conf, app = config.Config.load_paste_app('reddwarf-guestagent', options, args) conf, app = config.Config.load_paste_app('reddwarf-guestagent',
options, args)
server = service.Service.create(binary='reddwarf-guestagent') server = service.Service.create(binary='reddwarf-guestagent')
service.serve(server) service.serve(server)
service.wait() service.wait()
@ -54,4 +55,3 @@ if __name__ == '__main__':
import traceback import traceback
print traceback.format_exc() print traceback.format_exc()
sys.exit("ERROR: %s" % error) sys.exit("ERROR: %s" % error)

View File

@ -46,7 +46,8 @@ if __name__ == '__main__':
(options, args) = config.parse_options(parser) (options, args) = config.parse_options(parser)
try: try:
conf, app = config.Config.load_paste_app('reddwarf-taskmanager', options, args) conf, app = config.Config.load_paste_app('reddwarf-taskmanager',
options, args)
server = service.Service.create(binary='reddwarf-taskmanager') server = service.Service.create(binary='reddwarf-taskmanager')
service.serve(server) service.serve(server)
service.wait() service.wait()

View File

@ -31,6 +31,7 @@ from reddwarf import version
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class Launcher(object): class Launcher(object):
"""Launch one or more services and wait for them to complete.""" """Launch one or more services and wait for them to complete."""
@ -65,7 +66,6 @@ class Launcher(object):
pass pass
class Service(object): class Service(object):
"""Generic code to start services and get them listening on rpc""" """Generic code to start services and get them listening on rpc"""
@ -95,7 +95,6 @@ class Service(object):
manager = self.__dict__.get('manager', None) manager = self.__dict__.get('manager', None)
return getattr(manager, key) return getattr(manager, key)
def start(self): def start(self):
vcs_string = version.version_string_with_vcs() vcs_string = version.version_string_with_vcs()
LOG.info(_('Starting %(topic)s node (version %(vcs_string)s)'), LOG.info(_('Starting %(topic)s node (version %(vcs_string)s)'),
@ -165,6 +164,7 @@ class Service(object):
_launcher = None _launcher = None
def serve(*servers): def serve(*servers):
global _launcher global _launcher
if not _launcher: if not _launcher:
@ -172,6 +172,7 @@ def serve(*servers):
for server in servers: for server in servers:
_launcher.launch_server(server) _launcher.launch_server(server)
def wait(): def wait():
try: try:
_launcher.wait() _launcher.wait()

View File

@ -119,6 +119,7 @@ class MethodInspector(object):
args_str = ' '.join(required + optionals) args_str = ' '.join(required + optionals)
return "%s %s" % (self._func.__name__, args_str) return "%s %s" % (self._func.__name__, args_str)
class LoopingCallDone(Exception): class LoopingCallDone(Exception):
"""Exception to break out and stop a LoopingCall. """Exception to break out and stop a LoopingCall.

View File

@ -58,7 +58,8 @@ class InstanceController(BaseController):
def index(self, req, tenant_id): def index(self, req, tenant_id):
"""Return all instances.""" """Return all instances."""
servers = models.Instances(req.headers["X-Auth-Token"]).data() servers = models.Instances(req.headers["X-Auth-Token"]).data()
#TODO(hub-cap): Remove this, this is only for testing communication between services #TODO(hub-cap): Remove this, this is only for testing communication
# between services
rpc.cast(context.ReddwarfContext(), "taskmanager.None", rpc.cast(context.ReddwarfContext(), "taskmanager.None",
{"method": "test_method", "BARRRR": "ARGGGGG"}) {"method": "test_method", "BARRRR": "ARGGGGG"})

View File

@ -19,16 +19,15 @@ import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class GuestAgent(object): class GuestAgent(object):
"""Task manager impl""" """Task manager impl"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
LOG.info("GuestAgent init %s %s"% (args, kwargs)) LOG.info("GuestAgent init %s %s" % (args, kwargs))
def periodic_tasks(self, raise_on_error=False): def periodic_tasks(self, raise_on_error=False):
LOG.info("Launching a periodic task") LOG.info("Launching a periodic task")
def test_method(self, context): def test_method(self, context):
LOG.info("test_method called with context %s" % context) LOG.info("test_method called with context %s" % context)

View File

@ -29,6 +29,7 @@ class Controller(wsgi.Controller):
"""Base controller class.""" """Base controller class."""
pass pass
class API(wsgi.Router): class API(wsgi.Router):
"""API""" """API"""
def __init__(self): def __init__(self):
@ -44,4 +45,3 @@ class API(wsgi.Router):
def app_factory(global_conf, **local_conf): def app_factory(global_conf, **local_conf):
return API() return API()

View File

@ -19,16 +19,15 @@ import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class TaskManager(object): class TaskManager(object):
"""Task manager impl""" """Task manager impl"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
LOG.info("TaskManager init %s %s"% (args, kwargs)) LOG.info("TaskManager init %s %s" % (args, kwargs))
def periodic_tasks(self, raise_on_error=False): def periodic_tasks(self, raise_on_error=False):
LOG.info("Launching a periodic task") LOG.info("Launching a periodic task")
def test_method(self, context): def test_method(self, context):
LOG.info("test_method called with context %s" % context) LOG.info("test_method called with context %s" % context)