Modify

Ticket #387 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

Traceback when clicking on any ConfigFile entry in the Config Items -> Bad webpage

Reported by: anonymous Owned by: hagedorn
Priority: major Milestone:
Component: bcfg2-reports Version: 0.9.x
Keywords: dynamic reporting system traceback Cc:

Description

When clicking on any ConfigFile? entry from the new Config Items -> Bad section of the dynamic reporting system webpage I get the following traceback :

NameError? at /elements/bad/6/ global name 'get_lexer_by_name' is not defined Request Method: GET Request URL: http://bcfg2-reports.chicagotrading.com/elements/bad/6/ Exception Type: NameError? Exception Value: global name 'get_lexer_by_name' is not defined Exception Location: /usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py in syntaxhilight, line 15 Template error

In template /usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/reports/templates/config_items/index.html, error at line 47 Caught an exception while rendering: global name 'get_lexer_by_name' is not defined 37 <tr><td align="right"><b>Permissions: </b></td><td>{{item.reason.perms}}</td><td>{{item.reason.current_perms}}</td></tr> 38 {% endif %}{% if item.reason.current_status %} 39 <tr><td align="right"><b>Status: </b></td><td>{{item.reason.status}}</td><td>{{item.reason.current_status}}</td></tr> 40 {% endif %}{% if item.reason.current_to %} 41 <tr><td align="right"><b>Link Destination: </b></td><td>{{item.reason.to}}</td><td>{{item.reason.current_to}}</td></tr> 42 {% endif %}{% if item.reason.current_version %} 43 <tr><td align="right"><b>Version: </b></td><td>{{item.reason.version}}</td><td>{{item.reason.current_version}}</td></tr> 44 {% endif %}{% if not item.reason.current_exists %} 45 <tr><td align="right"><b>Existance: </b></td><td colspan=2>This item does not currently exist on the host but is specified to exist in the configuration.</td></tr> 46 {% endif %}{% if item.reason.current_diff %} 47 <tr><td align="right"><b>NDiff: </b></td><td colspan=2><pre>{{item.reason.current_diff|syntaxhilight:"diff"}}</pre></td></tr> 48 {% endif %} 49 </table></center> 50 <hr/> 51 <div> 52 <span class="mini-date"> 53 <b>Enter date or use calendar popup: </b> 54 <form name="timestamp-select"> 55 <input type="text" name="date1" value="{{timestamp_date}}" size=10>@ 56 <input type="text" name="time" value="{{timestamp_time}}" size=8> 57 <a href="" onClick="cal.select(document.formstimestamp-select?.date1,'anchor1','yyyy-MM-dd'); return false;" Traceback (innermost last) Switch to copy-and-paste view

  • /usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py in render_node

699.

  1. def render_node(self, node, context):
  2. return(node.render(context)) 702.
  3. class DebugNodeList?(NodeList?):
  4. def render_node(self, node, context):
  5. try:
  6. result = node.render(context) ...
  7. except TemplateSyntaxError?, e:
  8. if not hasattr(e, 'source'):
  9. e.source = node.source
  10. raise
  11. except Exception, e:
  12. from sys import exc_info

▶ Local vars Variable Value context [{'block': <Block Node: content. Contents: [<Text Node: ' '>, <IfEqualNode?>, <Text Node: ' <center> <table border=1'>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <Text Node: ' </table></center> <hr/> '>, <Variable Node: timestamp_date>, <Text Node: '" size=10>@ <input type="'>, <Variable Node: timestamp_time>, <Text Node: '" size=8> <a href="" onCl'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: '/'+document.forms['timest'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: ;"/> </form> </span><br/'>, <If node>, <Text Node: ' '>]>}, {'timestamp': '[email protected]:14:14.347346', 'item': <Bad: /etc/bcfg2.conf>, 'mod_or_bad': 'bad', 'timestamp_date': '2007-02-02', 'timestamp_time': '14:14:14', 'associated_client_list': [<Client: localhost>]}] e <exceptions.NameError? instance at 0xb3a484cc> exc_info <built-in function exc_info> node <Variable Node: item.reason.current_diff|syntaxhilight:"diff"> self [<Text Node: ' <tr><td align="right"><b'>, <Variable Node: item.reason.current_diff|syntaxhilight:"diff">, <Text Node: '</pre></td></tr> '>] wrapped <django.template.TemplateSyntaxError? instance at 0xb3a4898c>

  • /usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py in render
    1. def render(self, context):
    2. output = self.filter_expression.resolve(context)
    3. return self.encode_output(output) 748.
    4. class DebugVariableNode?(VariableNode?):
    5. def render(self, context):
    6. try:
    7. output = self.filter_expression.resolve(context) ...
    8. except TemplateSyntaxError?, e:
    9. if not hasattr(e, 'source'):
    10. e.source = self.source
    11. raise
    12. return self.encode_output(output)

758.

▶ Local vars Variable Value context [{'block': <Block Node: content. Contents: [<Text Node: ' '>, <IfEqualNode?>, <Text Node: ' <center> <table border=1'>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <Text Node: ' </table></center> <hr/> '>, <Variable Node: timestamp_date>, <Text Node: '" size=10>@ <input type="'>, <Variable Node: timestamp_time>, <Text Node: '" size=8> <a href="" onCl'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: '/'+document.forms['timest'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: ;"/> </form> </span><br/'>, <If node>, <Text Node: ' '>]>}, {'timestamp': '[email protected]:14:14.347346', 'item': <Bad: /etc/bcfg2.conf>, 'mod_or_bad': 'bad', 'timestamp_date': '2007-02-02', 'timestamp_time': '14:14:14', 'associated_client_list': [<Client: localhost>]}] self <Variable Node: item.reason.current_diff|syntaxhilight:"diff">

  • /usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py in resolve
    1. for func, args in self.filters:
    2. arg_vals = []
    3. for lookup, arg in args:
    4. if not lookup:
    5. arg_vals.append(arg)
    6. else:
    7. arg_vals.append(resolve_variable(arg, context))
    8. obj = func(obj, *arg_vals) ...
    9. return obj 563.
    10. def args_check(name, func, provided):
    11. provided = list(provided)
    12. plen = len(provided)
    13. args, varargs, varkw, defaults = getargspec(func)
    ▶ Local vars Variable Value arg 'diff' arg_vals diff? args [(False, 'diff')] context [{'block': <Block Node: content. Contents: [<Text Node: ' '>, <IfEqualNode?>, <Text Node: ' <center> <table border=1'>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <If node>, <Text Node: ' </table></center> <hr/> '>, <Variable Node: timestamp_date>, <Text Node: '" size=10>@ <input type="'>, <Variable Node: timestamp_time>, <Text Node: '" size=8> <a href="" onCl'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: '/'+document.forms['timest'>, <Variable Node: mod_or_bad>, <Text Node: '/'>, <Variable Node: item.id>, <Text Node: ;"/> </form> </span><br/'>, <If node>, <Text Node: ' '>]>}, {'timestamp': '[email protected]:14:14.347346', 'item': <Bad: /etc/bcfg2.conf>, 'mod_or_bad': 'bad', 'timestamp_date': '2007-02-02', 'timestamp_time': '14:14:14', 'associated_client_list': [<Client: localhost>]}] func <function syntaxhilight at 0xb3aa7fb4> ignore_failures False lookup False obj '"--- \n\n+++ \n\[email protected]@ -1,5 +1,5 @@\n\n [server]\n-repository = /disks/bcfg2\n+repository = /sandbox/bcfg2\n structures = Bundler,Base\n generators = SSHbase,Cfg,Pkgmgr,Svcmgr\n \[email protected]@ -8,9 +8,9 @@\n\n \n [communication]\n protocol = xmlrpc/ssl\n-password = ctcrules\n+password = ctcrules \n key = /etc/bcfg2.key\n \n [components]\n-bcfg2 = http://localhost:6789\n+bcfg2 = https://localhost:6789\n "' self <django.template.FilterExpression? object at 0xb3a366cc>
  • /usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py in syntaxhilight
    1. except:
    2. colorize = False
    10.
    1. register = template.Library() 12.
    2. def syntaxhilight(value, arg="diff"):
    3. Returns a syntax-hilighted version of Code; requires code and language arguments
    4. lexer = get_lexer_by_name(arg) ...
    5. if colorize:
    6. try:
    7. return highlight(value, lexer, HtmlFormatter?())
    8. except:
    9. return value
    10. else:
    ▶ Local vars Variable Value arg 'diff' value '"--- \n\n+++ \n\[email protected]@ -1,5 +1,5 @@\n\n [server]\n-repository = /disks/bcfg2\n+repository = /sandbox/bcfg2\n structures = Bundler,Base\n generators = SSHbase,Cfg,Pkgmgr,Svcmgr\n \[email protected]@ -8,9 +8,9 @@\n\n \n [communication]\n protocol = xmlrpc/ssl\n-password = ctcrules\n+password = ctcrules \n key = /etc/bcfg2.key\n \n [components]\n-bcfg2 = http://localhost:6789\n+bcfg2 = https://localhost:6789\n "'

Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py" in render_node

  1. result = node.render(context)

File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py" in render

  1. output = self.filter_expression.resolve(context)

File "/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/init.py" in resolve

  1. obj = func(obj, *arg_vals)

File "/usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py" in syntaxhilight

  1. lexer = get_lexer_by_name(arg)

NameError? at /elements/bad/6/ global name 'get_lexer_by_name' is not defined

Request information GET

No GET data POST

No POST data COOKIES

No cookie data META Variable Value AUTH_TYPE 'Basic' CONTENT_LENGTH 0L CONTENT_TYPE None GATEWAY_INTERFACE 'CGI/1.1' HTTP_ACCEPT 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' HTTP_ACCEPT_CHARSET 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' HTTP_ACCEPT_ENCODING 'gzip,deflate' HTTP_ACCEPT_LANGUAGE 'en-us,en;q=0.5' HTTP_AUTHORIZATION 'Basic ZmxvcmVzcDpCTXoqNih2eA==' HTTP_CONNECTION 'keep-alive' HTTP_HOST 'bcfg2-reports.chicagotrading.com' HTTP_KEEP_ALIVE '300' HTTP_REFERER 'http://bcfg2-reports.chicagotrading.com/elements/bad/' HTTP_USER_AGENT 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20060601 Firefox/2.0.0.1 (Ubuntu-edgy)' PATH_INFO '/bad/6/' PATH_TRANSLATED None QUERY_STRING None REMOTE_ADDR '10.0.1.195' REMOTE_HOST None REMOTE_IDENT None REMOTE_USER 'floresp' REQUEST_METHOD 'GET' SCRIPT_NAME None SERVER_NAME 'bcfg2-reports.chicagotrading.com' SERVER_PORT 0 SERVER_PROTOCOL 'HTTP/1.1' SERVER_SOFTWARE 'mod_python' Settings Using settings module Bcfg2.Server.Reports.settings Setting Value ABSOLUTE_URL_OVERRIDES {} ADMINS (('Joey Hagedorn', '[email protected]…'),) ADMIN_FOR () ADMIN_MEDIA_PREFIX '/media/' ALLOWED_INCLUDE_ROOTS () APPEND_SLASH True AUTHENTICATION_BACKENDS ('django.contrib.auth.backends.ModelBackend?', 'Bcfg2.Server.Reports.backends.NISBackend') AUTHORIZED_GROUP BANNED_IPS () CACHE_BACKEND 'simple://' CACHE_MIDDLEWARE_KEY_PREFIX COMMENTS_ALLOW_PROFANITIES False COMMENTS_BANNED_USERS_GROUP None COMMENTS_FIRST_FEW 0 COMMENTS_MODERATORS_GROUP None COMMENTS_SKETCHY_USERS_GROUP None DATABASE_ENGINE 'sqlite3' DATABASE_HOST DATABASE_NAME '/disks/bcfg2/etc/brpt.sqlite' DATABASE_PASSWORD '' DATABASE_PORT DATABASE_USER DATETIME_FORMAT 'N j, Y, P' DATE_FORMAT 'N j, Y' DEBUG True DEFAULT_CHARSET 'utf-8' DEFAULT_CONTENT_TYPE 'text/html' DEFAULT_FROM_EMAIL '[email protected]' DISALLOWED_USER_AGENTS () EMAIL_HOST 'localhost' EMAIL_HOST_PASSWORD '' EMAIL_HOST_USER EMAIL_PORT 25 EMAIL_SUBJECT_PREFIX '[Django] ' ENABLE_PSYCO False IGNORABLE_404_ENDS ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php') IGNORABLE_404_STARTS ('/cgi-bin/', '/_vti_bin', '/_vti_inf') INSTALLED_APPS ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'Bcfg2.Server.Reports.reports'] INTERNAL_IPS () JING_PATH '/usr/bin/jing' LANGUAGES (('ar', 'Arabic'), ('bn', 'Bengali'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('pt-br', 'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('uk', 'Ukrainian'), ('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Traditional Chinese')) LANGUAGES_BIDI ('he', 'ar') LANGUAGE_CODE 'en-us' MANAGERS (('Joey Hagedorn', '[email protected]…'),) MEDIA_ROOT MEDIA_URL MIDDLEWARE_CLASSES ('django.middleware.common.CommonMiddleware?', 'django.contrib.sessions.middleware.SessionMiddleware?', 'django.contrib.auth.middleware.AuthenticationMiddleware?', 'django.middleware.doc.XViewMiddleware') MONTH_DAY_FORMAT 'F j' PREPEND_WWW False ROOT_URLCONF 'Bcfg2.Server.Reports.urls' SECRET_KEY '' SEND_BROKEN_LINK_EMAILS False SERVER_EMAIL '[email protected]' SESSION_COOKIE_AGE 1209600 SESSION_COOKIE_DOMAIN None SESSION_COOKIE_NAME 'sessionid' SESSION_EXPIRE_AT_BROWSER_CLOSE True SESSION_SAVE_EVERY_REQUEST False SETTINGS_MODULE 'Bcfg2.Server.Reports.settings' SITE_ID 1 TEMPLATE_CONTEXT_PROCESSORS ('django.core.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n') TEMPLATE_DEBUG True TEMPLATE_DIRS () TEMPLATE_LOADERS ('django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source') TEMPLATE_STRING_IF_INVALID TIME_FORMAT 'P' TIME_ZONE 'America/Chicago?' TRANSACTIONS_MANAGED False USE_ETAGS False USE_I18N True YEAR_MONTH_FORMAT 'F Y'

Attachments

reports.diff (1.1 KB) - added by desai 15 years ago.

Change History

comment:1 Changed 15 years ago by anonymous

  • Version set to 0.9.0

Changed 15 years ago by desai

comment:2 Changed 15 years ago by desai

  • Status changed from new to closed
  • Resolution set to fixed

This attached patch should fix it. Committed in [a195b9bf6ca1713305f95a3db9d2c3352f568eba] (SVN r2794)

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.