opinkerfi / adagios

Adagios - Web Based Nagios Configuration
GNU Affero General Public License v3.0
327 stars 75 forks source link

Error when Creating Contact Template #219

Closed willdeberry closed 11 years ago

willdeberry commented 11 years ago

Trying to add template: Contact Object Type: Contact Name: Test (have tried multiple names and all cause error)

Environment:

Request Method: POST
Request URL: http://nagios-dev.hq/adagios/objectbrowser/add/template

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.sites',
 'adagios.objectbrowser',
 'adagios.rest',
 'adagios.misc',
 'adagios.pnp',
 'adagios.status',
 'adagios.okconfig_',
 'adagios.pages',
 'adagios.bi']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware')

Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/opt/adagios/adagios/objectbrowser/views.py" in add_object
  683.             c['form'].save()
File "/opt/adagios/adagios/objectbrowser/forms.py" in save
  142.         self.pynag_object.save()
File "/usr/local/lib/python2.7/dist-packages/pynag/Utils/__init__.py" in newFunction
  982.                 return f(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/pynag/Model/__init__.py" in save
  843.                 self.set_filename(self.get_suggested_filename())
File "/usr/local/lib/python2.7/dist-packages/pynag/Model/__init__.py" in get_suggested_filename
  796.         description = re.sub(invalid_chars, '', self.get_description())
File "/usr/lib/python2.7/re.py" in sub
  151.     return _compile(pattern, flags).sub(repl, string, count)

Exception Type: TypeError at /objectbrowser/add/template
Exception Value: expected string or buffer
palli commented 11 years ago

Ok this is fixed in pynag commit 1565f058af23dcf0a4b5902eef5134e30861a359

palli commented 11 years ago

Try upgrading pynag to at least version pynag-0.6.1-1.git.31.1565f05

yum clean all --enablerepo=ok-testing
yum update pynag --enablerepo=ok-testing

That should fix the issue.

The issue was due to incorrect implementation of get_description() for contact templates.

pall-valmundsson commented 11 years ago

For future reference, this is the commit: https://github.com/pynag/pynag/commit/1565f058af23dcf0a4b5902eef5134e30861a359

willdeberry commented 11 years ago

Manually ripped out all files left over from pip after uninstall and built pynag from source. Restarted apache and all is working now.

Feel free to close out and thanks for the help.