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
run_tests.log
guest-agent-files.txt
reddwarf.egg*
reddwarf/vcsversion.py

View File

@ -46,7 +46,8 @@ if __name__ == '__main__':
(options, args) = config.parse_options(parser)
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')
service.serve(server)
service.wait()
@ -54,4 +55,3 @@ if __name__ == '__main__':
import traceback
print traceback.format_exc()
sys.exit("ERROR: %s" % error)

View File

@ -46,7 +46,8 @@ if __name__ == '__main__':
(options, args) = config.parse_options(parser)
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')
service.serve(server)
service.wait()

View File

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

View File

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

View File

@ -58,7 +58,8 @@ class InstanceController(BaseController):
def index(self, req, tenant_id):
"""Return all instances."""
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",
{"method": "test_method", "BARRRR": "ARGGGGG"})

View File

@ -19,16 +19,15 @@ import logging
LOG = logging.getLogger(__name__)
class GuestAgent(object):
"""Task manager impl"""
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):
LOG.info("Launching a periodic task")
def test_method(self, context):
LOG.info("test_method called with context %s" % context)

View File

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

View File

@ -19,16 +19,15 @@ import logging
LOG = logging.getLogger(__name__)
class TaskManager(object):
"""Task manager impl"""
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):
LOG.info("Launching a periodic task")
def test_method(self, context):
LOG.info("test_method called with context %s" % context)