# Tony Mack <tmack@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: Events.py,v 1.9 2006/11/29 22:14:32 tmack Exp $
+# $Id$
#
from PLC.Faults import *
'event_id': Parameter(int, "Event identifier"),
'person_id': Parameter(int, "Identifier of person responsible for event, if any"),
'node_id': Parameter(int, "Identifier of node responsible for event, if any"),
+ 'auth_type': Parameter(int, "Type of auth used. i.e. AuthMethod"),
'fault_code': Parameter(int, "Event fault code"),
'call_name': Parameter(str, "Call responsible for this event"),
'call': Parameter(str, "Call responsible for this event, including paramters"),
'message': Parameter(str, "High level description of this event"),
'runtime': Parameter(float, "Runtime of event"),
'time': Parameter(int, "Date and time that the event took place, in seconds since UNIX epoch", ro = True),
- 'object_ids': Parameter([int], "IDs of objects affected by this event")
+ 'object_ids': Parameter([int], "IDs of objects affected by this event"),
+ 'object_types': Parameter([str], "What type of object were affected by this event")
}
- def add_object(self, object_id, commit = True):
+ def add_object(self, object_type, object_id, commit = True):
"""
Relate object to this event.
"""
self['object_ids'] = []
if object_id not in self['object_ids']:
- self.api.db.do("INSERT INTO event_object (event_id, object_id)" \
- " VALUES(%(event_id)d, %(object_id)d)",
+ self.api.db.do("INSERT INTO event_object (event_id, object_id, object_type)" \
+ " VALUES(%(event_id)d, %(object_id)d, %(object_type)s)",
locals())
if commit: