Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UNHANDLED EXCEPTION (2015-02-05 22:18:53.804262)
- BRANCH: develop TIP: f95b08941cb0
- PROCESS: ./scripts/noc-web.py
- ERROR FINGERPRINT: a6d701cb-b9f6-51f3-b265-6705dfebdae0
- WORKING DIRECTORY: /opt/noc
- EXCEPTION: <class 'django.db.utils.DatabaseError'> column "cust_location" does not exist
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py (Line: 52)
- Function: execute
- 45 """
- 46
- 47 def __init__(self, cursor):
- 48 self.cursor = cursor
- 49
- 50 def execute(self, query, args=None):
- 51 try:
- 52 ==> return self.cursor.execute(query, args)
- 53 except Database.IntegrityError, e:
- 54 raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2]
- 55 except Database.DatabaseError, e:
- 56 raise utils.DatabaseError, utils.DatabaseError(*tuple(e)), sys.exc_info()[2]
- 57
- 58 def executemany(self, query, args):
- Variables:
- query =
- 'CREATE INDEX sa_managedobject_location ON sa_managedobject(cust_location)'
- self =
- <django.db.backends.postgresql_psycopg2.base.CursorWrapper object at 0x5417f90>
- args = None
- e = ProgrammingError('column "cust_location" does not exist\n',)
- ------------------------------------------------------------------------
- File: main/models/customfield.py (Line: 150)
- Function: exec_commit
- 143 @property
- 144 def db_drop_statement(self):
- 145 return "ALTER TABLE %s DROP COLUMN \"%s\"" % (
- 146 self.table, self.db_column)
- 147
- 148 def exec_commit(self, sql):
- 149 c = connection.cursor()
- 150 ==> c.execute(sql)
- 151 c.execute("COMMIT")
- 152
- 153 def activate_field(self):
- 154 self.exec_commit(self.db_create_statement)
- 155
- 156 def deactivate_field(self):
- Variables:
- c = <django.db.backends.util.CursorWrapper object at 0x56c4210>
- self = <CustomField: sa_managedobject.location>
- sql =
- 'CREATE INDEX sa_managedobject_location ON sa_managedobject(cust_location)'
- ------------------------------------------------------------------------
- File: main/models/customfield.py (Line: 161)
- Function: create_index
- 154 self.exec_commit(self.db_create_statement)
- 155
- 156 def deactivate_field(self):
- 157 self.exec_commit(self.db_drop_statement)
- 158
- 159 def create_index(self):
- 160 self.exec_commit("CREATE INDEX %s ON %s(%s)" % (
- 161 ==> self.index_name, self.table, self.db_column))
- 162
- 163 def drop_index(self):
- 164 self.exec_commit("DROP INDEX %s" % self.index_name)
- 165
- 166 def rename(self, old_name):
- 167 self.exec_commit("ALTER TABLE %s RENAME \"%s\" TO \"%s\"" % (
- Variables:
- self = <CustomField: sa_managedobject.location>
- ------------------------------------------------------------------------
- File: main/models/customfield.py (Line: 197)
- Function: save
- 190 self.activate_field()
- 191 if self.is_indexed:
- 192 self.create_index()
- 193 else:
- 194 self.deactivate_field()
- 195 elif self.is_indexed != old_indexed:
- 196 if self.is_indexed:
- 197 ==> self.create_index()
- 198 else:
- 199 self.drop_index()
- 200
- 201 def delete(self):
- 202 if self.is_active:
- 203 self.deactivate_field()
- Variables:
- old = <CustomField: sa_managedobject.location>
- self = <CustomField: sa_managedobject.location>
- args = ()
- old_active = True
- kwargs = {}
- old_indexed = False
- ------------------------------------------------------------------------
- File: lib/app/extmodelapplication.py (Line: 437)
- Function: _update_object
- 430
- 431 @view(method=["PUT"], url="^(?P<id>\d+)/?$", access="update", api=True)
- 432 def api_update(self, request, id):
- 433 def _update_object(o, attrs, m2m_attrs):
- 434 for k, v in attrs.items():
- 435 setattr(o, k, v)
- 436 try:
- 437 ==> o.save()
- 438 if m2m_attrs:
- 439 self.update_m2ms(o, m2m_attrs)
- 440 except IntegrityError:
- 441 return self.render_json(
- 442 {
- 443 "success": False,
- Variables:
- self =
- <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>
- request =
- <WSGIRequest
- path:/main/customfield/1/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {}>,
- COOKIES:{'csrftoken': 'lobFi4YNoBDu02croPBFXJLEI1WdOssR',
- 'sessionid': 'ecd2e1471b80b37f0db09ffac5f5ff49'},
- META:{'CONTENT_LENGTH': '261',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=lobFi4YNoBDu02croPBFXJLEI1WdOssR; sessionid=ecd2e1471b80b37f0db09ffac5f5ff49',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_REFERER': 'http://172.18.255.111/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/main/customfield/1/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'PUT',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1a0fed0>,
- 'wsgi.input': <_io.BytesIO object at 0x56ea5f0>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- o = <CustomField: sa_managedobject.location>
- m2m_attrs = {}
- attrs =
- {'description': 'Geographic location',
- 'enum_group': None,
- 'is_active': True,
- 'is_filtered': False,
- 'is_hidden': False,
- 'is_indexed': True,
- 'is_searchable': True,
- 'label': 'location',
- 'max_length': 60,
- 'name': 'location',
- 'regexp': None,
- 'table': 'sa_managedobject',
- 'type': 'str'}
- v = 'Geographic location'
- k = 'description'
- ------------------------------------------------------------------------
- File: lib/python2.7/site-packages/concurrent/futures/thread.py (Line: 61)
- Function: run
- 54 self.kwargs = kwargs
- 55
- 56 def run(self):
- 57 if not self.future.set_running_or_notify_cancel():
- 58 return
- 59
- 60 try:
- 61 ==> result = self.fn(*self.args, **self.kwargs)
- 62 except BaseException:
- 63 e, tb = sys.exc_info()[1:]
- 64 self.future.set_exception_info(e, tb)
- 65 else:
- 66 self.future.set_result(result)
- 67
- Variables:
- e = DatabaseError('column "cust_location" does not exist\n',)
- self = <concurrent.futures.thread._WorkItem object at 0x56e7e50>
- tb = <traceback object at 0x5523a28>
- ------------------------------------------------------------------------
- File: lib/python2.7/site-packages/concurrent/futures/_compat.py (Line: 107)
- Function: reraise
- 100
- 101 return result
- 102
- 103
- 104 if _sys.version_info[0] < 3:
- 105 def reraise(exc, traceback):
- 106 locals_ = {'exc_type': type(exc), 'exc_value': exc, 'traceback': traceback}
- 107 ==> exec('raise exc_type, exc_value, traceback', {}, locals_)
- 108 else:
- 109 def reraise(exc, traceback):
- 110 # Tracebacks are embedded in exceptions in Python 3
- 111 raise exc
- Variables:
- locals_ =
- {'exc_type': <class 'django.db.utils.DatabaseError'>,
- 'exc_value': DatabaseError('column "cust_location" does not exist\n',),
- 'traceback': <traceback object at 0x5523a28>}
- traceback = <traceback object at 0x5523a28>
- exc = DatabaseError('column "cust_location" does not exist\n',)
- ------------------------------------------------------------------------
- File: lib/python2.7/site-packages/concurrent/futures/_base.py (Line: 359)
- Function: __get_result
- 352 def done(self):
- 353 """Return True of the future was cancelled or finished executing."""
- 354 with self._condition:
- 355 return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]
- 356
- 357 def __get_result(self):
- 358 if self._exception:
- 359 ==> reraise(self._exception, self._traceback)
- 360 else:
- 361 return self._result
- 362
- 363 def add_done_callback(self, fn):
- 364 """Attaches a callable that will be called when the future finishes.
- 365
- Variables:
- self = <Future at 0x56e7f90 state=finished raised DatabaseError>
- ------------------------------------------------------------------------
- File: lib/python2.7/site-packages/concurrent/futures/_base.py (Line: 407)
- Function: result
- 400 return self.__get_result()
- 401
- 402 self._condition.wait(timeout)
- 403
- 404 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
- 405 raise CancelledError()
- 406 elif self._state == FINISHED:
- 407 ==> return self.__get_result()
- 408 else:
- 409 raise TimeoutError()
- 410
- 411 def exception_info(self, timeout=None):
- 412 """Return a tuple of (exception, traceback) raised by the call that the
- 413 future represents.
- Variables:
- self = <Future at 0x56e7f90 state=finished raised DatabaseError>
- timeout = 5.0
- ------------------------------------------------------------------------
- File: main/models/slowop.py (Line: 73)
- Function: submit
- 66 so.duration = time.time() - t0
- 67 so.save()
- 68
- 69 so = None
- 70 t0 = time.time()
- 71 future = cls.pool.submit(fn, *args, **kwargs)
- 72 try:
- 73 ==> future.result(cls.SLOW_TIMEOUT)
- 74 except concurrent.futures.TimeoutError:
- 75 logger.debug("Continuing slow operation %s (app=%s, user=%s)",
- 76 fn, app_id, user)
- 77 # Save slow op
- 78 now = datetime.datetime.now()
- 79 so = SlowOp(
- Variables:
- args =
- (<CustomField: sa_managedobject.location>,
- {'description': 'Geographic location',
- 'enum_group': None,
- 'is_active': True,
- 'is_filtered': False,
- 'is_hidden': False,
- 'is_indexed': True,
- 'is_searchable': True,
- 'label': 'location',
- 'max_length': 60,
- 'name': 'location',
- 'regexp': None,
- 'table': 'sa_managedobject',
- 'type': 'str'},
- {})
- app_id = 'main.customfield'
- t0 = 1423163933.532948
- future = <Future at 0x56e7f90 state=finished raised DatabaseError>
- so = None
- user = u'snake'
- kwargs = {}
- on_complete = <function on_complete at 0x56f29b0>
- fn = <function _update_object at 0x56f2a28>
- cls = <class 'noc.main.models.slowop.SlowOp'>
- ------------------------------------------------------------------------
- File: lib/app/extapplication.py (Line: 258)
- Function: submit_slow_op
- 251 else:
- 252 return self.response_accepted(request.path)
- 253
- 254 def submit_slow_op(self, request, fn, *args, **kwargs):
- 255 f = SlowOp.submit(
- 256 fn,
- 257 self.get_app_id(), request.user.username,
- 258 ==> *args, **kwargs
- 259 )
- 260 if f.done():
- 261 return f.result()
- 262 else:
- 263 return self.response_accepted(
- 264 location="%sfutures/%s/" % (self.base_url, f.slow_op.id)
- Variables:
- self =
- <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>
- args =
- (<CustomField: sa_managedobject.location>,
- {'description': 'Geographic location',
- 'enum_group': None,
- 'is_active': True,
- 'is_filtered': False,
- 'is_hidden': False,
- 'is_indexed': True,
- 'is_searchable': True,
- 'label': 'location',
- 'max_length': 60,
- 'name': 'location',
- 'regexp': None,
- 'table': 'sa_managedobject',
- 'type': 'str'},
- {})
- request =
- <WSGIRequest
- path:/main/customfield/1/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {}>,
- COOKIES:{'csrftoken': 'lobFi4YNoBDu02croPBFXJLEI1WdOssR',
- 'sessionid': 'ecd2e1471b80b37f0db09ffac5f5ff49'},
- META:{'CONTENT_LENGTH': '261',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=lobFi4YNoBDu02croPBFXJLEI1WdOssR; sessionid=ecd2e1471b80b37f0db09ffac5f5ff49',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_REFERER': 'http://172.18.255.111/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/main/customfield/1/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'PUT',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1a0fed0>,
- 'wsgi.input': <_io.BytesIO object at 0x56ea5f0>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- fn = <function _update_object at 0x56f2a28>
- kwargs = {}
- ------------------------------------------------------------------------
- File: lib/app/extmodelapplication.py (Line: 478)
- Function: api_update
- 471 "traceback": str(why)
- 472 }, status=self.BAD_REQUEST)
- 473 try:
- 474 o = self.queryset(request).get(**{self.pk: int(id)})
- 475 except self.model.DoesNotExist:
- 476 return HttpResponse("", status=self.NOT_FOUND)
- 477 return self.submit_slow_op(request, _update_object,
- 478 ==> o, attrs, m2m_attrs)
- 479
- 480 @view(method=["DELETE"], url="^(?P<id>\d+)/?$", access="delete", api=True)
- 481 def api_delete(self, request, id):
- 482 def _delete_object(o):
- 483 o.delete() # @todo: Detect errors
- 484 return HttpResponse(status=self.DELETED)
- Variables:
- _update_object = <function _update_object at 0x56f2a28>
- self =
- <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>
- request =
- <WSGIRequest
- path:/main/customfield/1/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {}>,
- COOKIES:{'csrftoken': 'lobFi4YNoBDu02croPBFXJLEI1WdOssR',
- 'sessionid': 'ecd2e1471b80b37f0db09ffac5f5ff49'},
- META:{'CONTENT_LENGTH': '261',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=lobFi4YNoBDu02croPBFXJLEI1WdOssR; sessionid=ecd2e1471b80b37f0db09ffac5f5ff49',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_REFERER': 'http://172.18.255.111/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/main/customfield/1/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'PUT',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1a0fed0>,
- 'wsgi.input': <_io.BytesIO object at 0x56ea5f0>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- m2m_attrs = {}
- o = <CustomField: sa_managedobject.location>
- id = u'1'
- attrs =
- {'description': 'Geographic location',
- 'enum_group': None,
- 'is_active': True,
- 'is_filtered': False,
- 'is_hidden': False,
- 'is_indexed': True,
- 'is_searchable': True,
- 'label': 'location',
- 'max_length': 60,
- 'name': 'location',
- 'regexp': None,
- 'table': 'sa_managedobject',
- 'type': 'str'}
- ------------------------------------------------------------------------
- File: lib/app/site.py (Line: 248)
- Function: inner
- 241 a = dict((k, v[0] if len(v) == 1 else v)
- 242 for k, v in request.GET.lists())
- 243 app_logger.debug("API %s %s %s",
- 244 request.method, request.path, a)
- 245 # Call handler
- 246 v.__dict__["hits_metric"] += 1
- 247 with v.__dict__["time_metric"].timer():
- 248 ==> r = v(request, *args, **kwargs)
- 249 # Dump SQL statements
- 250 if self.log_sql_statements:
- 251 from django.db import connections
- 252 tsc = 0
- 253 sc = defaultdict(int)
- 254 for conn in connections.all():
- Variables:
- args = ()
- view_map =
- {'DELETE': <bound method CustomFieldApplication.api_delete of <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>>,
- 'GET': <bound method CustomFieldApplication.api_read of <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>>,
- 'PUT': <bound method CustomFieldApplication.api_update of <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>>}
- Form = <class 'django.forms.forms.Form'>
- PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
- DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
- self = <noc.lib.app.site.Site object at 0x2154090>
- v =
- <bound method CustomFieldApplication.api_update of <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>>
- request =
- <WSGIRequest
- path:/main/customfield/1/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {}>,
- COOKIES:{'csrftoken': 'lobFi4YNoBDu02croPBFXJLEI1WdOssR',
- 'sessionid': 'ecd2e1471b80b37f0db09ffac5f5ff49'},
- META:{'CONTENT_LENGTH': '261',
- 'CONTENT_TYPE': 'application/json; charset=UTF-8',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=lobFi4YNoBDu02croPBFXJLEI1WdOssR; sessionid=ecd2e1471b80b37f0db09ffac5f5ff49',
- 'HTTP_HOST': '127.0.0.1:8000',
- 'HTTP_REFERER': 'http://172.18.255.111/main/desktop/',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0',
- 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
- 'PATH_INFO': u'/main/customfield/1/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'PUT',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': '127.0.0.1',
- 'SERVER_PORT': '8000',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x1a0fed0>,
- 'wsgi.input': <_io.BytesIO object at 0x56ea5f0>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- app_logger = <logging.Logger object at 0x3dc1310>
- InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
- to_log_api_call = False
- kwargs = {'id': u'1'}
- nq = <function nq at 0x56f2050>
- app =
- <noc.main.apps.customfield.views.CustomFieldApplication object at 0x3dc1150>
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement