Ask Your Question
1

debugging code flow in packstack

asked 2014-03-26 14:39:54 -0600

waqasriaz gravatar image

I have been using devstack and packstack for a while. I have found pdb a very useful tool for interactive debugging code flow. In devstack I can easily add pdb.set_trace() and start debugging code in screens. I was wondering if there is a way to do the same in packstack. I tried adding pdb.set_trace() to code in packstack but couldn't figure out where to get the prompt for Pdb.

Any suggestions would be a great help!!!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-04-02 19:54:04 -0600

larsks gravatar image

Where did you place the set_trace() calls? What happened?

If I start by adding pdb.set_trace() to the beginning of main in packstack/installer/run_setup.py, then packstack drops to the (Pdb) prompt immediately after starting up:

# packstack --allinone
> /usr/lib/python2.6/site-packages/packstack/installer/run_setup.py(840)main()
-> try:
(Pdb)

Similarly, if I set the breakpoint at the beginning of initConfig in packstack/plugins/nova_300.py, it also works:

# packstack --allinone
> /usr/lib/python2.6/site-packages/packstack/plugins/nova_300.py(28)initConfig()
-> controller = controllerObject
(Pdb) dir(controllerObject)
['CONF', 'MESSAGES', '_Controller__GROUPS', '_Controller__PLUGINS', '_Controller__SEQUENCES', '_Controller__getGroupIndexByDesc', '_Controller__getSequenceIndexByDesc', '_Controller__single', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'addGroup', 'addPlugin', 'addResource', 'addSequence', 'getAllGroups', 'getAllPlugins', 'getAllSequences', 'getGroupByName', 'getParamByName', 'getParamKeyValue', 'getPluginByName', 'getSequenceByDesc', 'insertGroupBeforeGroup', 'insertSequence', 'insertSequenceBeforeSequence', 'resources', 'runAllSequences']

This all seems to work as one would expect.

One thing to remember about packstack is that its primary purpose is to build a series of Puppet manifests and then use ssh to run puppet apply on your target hosts. This means that much of the activity is happening on remote hosts and is managed by Puppet, so you'll need to leverage something other than pdb to see what's going on here.

edit flag offensive delete link more

Comments

@larsks thanks for your kind reply.I have already installed packstack,everything is running fine.I am customizing some codes according to my requirement and observing its behaviour,everytime put a debug statement and check logs,I was looking for some interactive debugger in rdo openstack

waqasriaz gravatar imagewaqasriaz ( 2014-04-17 14:25:33 -0600 )edit

@waqasriaz -- I'm not sure I understood your comment. Did this answer help out? It seems to demonstrate exactly what you want (dropping to an interactive debugging prompt from various points within packstack).

larsks gravatar imagelarsks ( 2014-04-25 11:24:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-03-26 14:39:54 -0600

Seen: 326 times

Last updated: Apr 02 '14