original_docstring: Store the Event in the database.
docstring: Store the Event in the database.
docstring_tokens: Store the Event in the database .
code: def store(self):
          """Store the Event in the database."""
          ev = {
              'resource_name': self.resource_name,
              'physical_resource_id': self.physical_resource_id,
              'stack_id': self.stack.id,
              'resource_action': self.action,
              'resource_status': self.status,
              'resource_status_reason': self.reason,
              'resource_type': self.resource_type,
              'resource_properties': self.resource_properties,
          }
  
          if self.uuid is not None:
              ev['uuid'] = self.uuid
  
          if self.timestamp is not None:
              ev['created_at'] = self.timestamp
  
          try:
              new_ev = event_object.Event.create(self.context, ev)
          except oslo_db.exception.DBError:
              # Attempt do drop the largest key and re-store as we expect
              # This to mostly happen with one large config blob property
              max_key, max_val = max(ev['resource_properties'].items(),
                                     key=lambda i: len(repr(i[1])))
              err = 'Resource properties are too large to store'
              ev['resource_properties'].update({'Error': err})
              ev['resource_properties'][max_key] = '<Deleted, too large>'
              try:
                  new_ev = event_object.Event.create(self.context, ev)
              except oslo_db.exception.DBError:
                  # Give up and drop all properties..
                  ev['resource_properties'] = {'Error': err}
                  new_ev = event_object.Event.create(self.context, ev)
          self.id = new_ev.id
          return self.id
code_tokens: def store ( self ) : ev = { 'resource_name' : self . resource_name , 'physical_resource_id' : self . physical_resource_id , 'stack_id' : self . stack . id , 'resource_action' : self . action , 'resource_status' : self . status , 'resource_status_reason' : self . reason , 'resource_type' : self . resource_type , 'resource_properties' : self . resource_properties , } if self . uuid is not None : ev [ 'uuid' ] = self . uuid if self . timestamp is not None : ev [ 'created_at' ] = self . timestamp try : new_ev = event_object . Event . create ( self . context , ev ) except oslo_db . exception . DBError : max_key , max_val = max ( ev [ 'resource_properties' ] . items ( ) , key = lambda i : len ( repr ( i [ 1 ] ) ) ) err = 'Resource properties are too large to store' ev [ 'resource_properties' ] . update ( { 'Error' : err } ) ev [ 'resource_properties' ] [ max_key ] = '<Deleted, too large>' try : new_ev = event_object . Event . create ( self . context , ev ) except oslo_db . exception . DBError : ev [ 'resource_properties' ] = { 'Error' : err } new_ev = event_object . Event . create ( self . context , ev ) self . id = new_ev . id return self . id
short_docstring: Store the Event in the database.
short_docstring_tokens: Store the Event in the database .
comment: """Store the Event in the database."""$SEP$# Attempt do drop the largest key and re-store as we expect$SEP$# This to mostly happen with one large config blob property$SEP$# Give up and drop all properties..