Merge pull request #86 from dhellmann/feature/debug-rug-app

Add debug rug app
This commit is contained in:
Ryan Petrello 2014-01-03 08:13:18 -08:00
commit d2d62cb09a
3 changed files with 66 additions and 3 deletions

61
akanda/rug/debug.py Normal file
View File

@ -0,0 +1,61 @@
import logging
import os
import sys
from oslo.config import cfg
from akanda.rug import main
from akanda.rug import state
class Fake(object):
def __init__(self, crud):
self.crud = crud
def delete_callback(self):
print 'DELETE'
def bandwidth_callback(self, *args, **kwargs):
print 'BANDWIDTH:', args, kwargs
def debug_one_router(args=sys.argv[1:]):
main.register_and_load_opts(args)
# Add our extra option for specifying the router-id to debug
cfg.CONF.register_cli_opts([
cfg.StrOpt('router-id',
required=True,
help='The UUID for the router to debug',
),
])
cfg.CONF(args, project='akanda')
logging.basicConfig(
level=logging.DEBUG,
format=':'.join('%(' + n + ')s'
for n in ['processName',
'threadName',
'name',
'levelname',
'message']),
)
log = logging.getLogger(__name__)
log.debug('Proxy settings: %r', os.getenv('no_proxy'))
a = state.Automaton(
cfg.CONF.router_id,
delete_callback,
bandwidth_callback
)
a.send_message(Fake('update'))
import pdb
pdb.set_trace()
a.update()

View File

@ -141,11 +141,10 @@ def register_and_load_opts(argv):
help='name of the exchange where we receive RPC calls'),
])
cfg.CONF(argv, project='akanda')
def main(argv=sys.argv[1:]):
register_and_load_opts(argv)
cfg.CONF(argv, project='akanda')
log.setup('akanda-rug')
cfg.CONF.log_opt_values(LOG, logging.INFO)

View File

@ -13,7 +13,9 @@ setup(
'httplib2>=0.7.2',
'python-neutronclient>=2.1',
'oslo.config',
'kombu>=2.4.8'
'kombu>=2.4.8',
'webob',
'python-novaclient',
],
namespace_packages=['akanda'],
packages=find_packages(exclude=['test']),
@ -22,6 +24,7 @@ setup(
entry_points={
'console_scripts': [
'akanda-rug-service=akanda.rug.main:main',
'akanda-debug-router=akanda.rug.debug:debug_one_router',
]
},
)