Debugging Foreman

Occasionally I will have missed a bug, and you might see the following page when you click a link:

internalservererrorPlease raise a ticket and I’ll try and fix it – add a screenshot of the command line error you see and also what you did to create the error. However, if you’d like to try and debug this yourself, I suggest you turn on debug mode. The default config file has debug turned off but you can easily turn this on by changing debug = true. The config files are located at <foreman root>\foreman\config, and should have an entry like this:

# Debugging options. Set to true if Foreman errors and you would like an interactive debugger.
debug = true

Restart the Foreman server with the edited config file, and now, instead of the page above, you will get an interactive Python debugger!


If you hover over one of the light blue lines, a little black command line icon in the right-hand corner will appear. Click on that and you can now type in Python to interact with Foreman. The best starting point is to type dump() which will show all the variables currently in use:


This should help in working out what is wrong. Usually Foreman is expecting a value and the variable is actually null (None in Python).

Happy bug hunting!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s