Beispiel #1
0
 def append_to_log(self, task, log):
     """
     Append a log entry the tasks log
     """
     # This needs to be done in the database to prevent lost updates
     query = {'_id': task['_id']}
     update = {'$push': {'log': log}}
     result = self.update(query, update, multi=False)
     send_log_notification('task', task, log)
     return result
Beispiel #2
0
 def append_to_log(self, task, log):
     """
     Append a log entry the tasks log
     """
     # This needs to be done in the database to prevent lost updates
     query = {
         '_id': task['_id']
     }
     update = {
         '$push': {
             'log': log
         }
     }
     result = self.update(query, update, multi=False)
     send_log_notification('task', task, log)
     return result
Beispiel #3
0
    def append_to_log(self, user, id, record):
        def mongo_safe_value(value):
            new_value = {}

            if not isinstance(value, dict):
                return value
            else:
                for (k, v) in six.iteritems(value):
                    if '.' in str(k) or '$' in str(k):
                        k = k.replace('.', '\\u002e').replace('$', '\\u0024')

                    new_value[k] = mongo_safe_value(v)

            return new_value
        # Load first to force access check
        log = mongo_safe_value(record)
        cluster = self.load(id, user=user, level=AccessType.WRITE)
        self.update({'_id': ObjectId(id)},
                    {'$push': {
                        'log': mongo_safe_value(record)
                    }})
        send_log_notification('cluster', cluster, log)
Beispiel #4
0
    def append_to_log(self, user, id, record):
        def mongo_safe_value(value):
            new_value = {}

            if not isinstance(value, dict):
                return value
            else:
                for (k, v) in six.iteritems(value):
                    if '.' in str(k) or '$' in str(k):
                        k = k.replace('.', '\\u002e').replace('$', '\\u0024')

                    new_value[k] = mongo_safe_value(v)

            return new_value
        # Load first to force access check
        log = mongo_safe_value(record)
        cluster = self.load(id, user=user, level=AccessType.WRITE)
        self.update({'_id': ObjectId(id)},
                    {'$push': {
                        'log': mongo_safe_value(record)
                    }})
        send_log_notification('cluster', cluster, log)
Beispiel #5
0
 def append_to_log(self, user, _id, record):
     job = self.load(_id, user=user, level=AccessType.WRITE)
     self.update({"_id": ObjectId(_id)}, {"$push": {"log": record}})
     send_log_notification("job", job, record)
Beispiel #6
0
 def append_to_log(self, user, id, record):
     volume = self.load(id, user=user, level=AccessType.WRITE)
     self.update({'_id': ObjectId(id)}, {'$push': {'log': record}})
     send_log_notification('volume', volume, record)
Beispiel #7
0
 def append_to_log(self, user, id, record):
     volume = self.load(id, user=user, level=AccessType.WRITE)
     self.update({'_id': ObjectId(id)}, {'$push': {'log': record}})
     send_log_notification('volume', volume, record)
Beispiel #8
0
 def append_to_log(self, user, _id, record):
     job = self.load(_id, user=user, level=AccessType.WRITE)
     self.update({'_id': ObjectId(_id)}, {'$push': {'log': record}})
     send_log_notification('job', job, record)