git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added BootmanSequenceRecord to allow bootman sequence to be modified at
[monitor.git]
/
monitor
/
database
/
info
/
action.py
diff --git
a/monitor/database/info/action.py
b/monitor/database/info/action.py
index
0abec62
..
704f733
100644
(file)
--- a/
monitor/database/info/action.py
+++ b/
monitor/database/info/action.py
@@
-67,9
+67,9
@@
class BlacklistRecord(Entity):
return False
else:
if self.date_created + timedelta(0,self.expires) > datetime.now():
return False
else:
if self.date_created + timedelta(0,self.expires) > datetime.now():
- return True
- else:
return False
return False
+ else:
+ return True
def willExpire(self):
if self.neverExpires():
def willExpire(self):
if self.neverExpires():
@@
-77,13
+77,23
@@
class BlacklistRecord(Entity):
else:
return self.date_created + timedelta(0, self.expires)
else:
return self.date_created + timedelta(0, self.expires)
+class BootmanSequenceRecord(Entity):
+ sequence = Field(String, primary_key=True, default=None)
+ action = Field(String, default=None)
+ date_created = Field(DateTime,default=datetime.now)
+
class ActionRecord(Entity):
@classmethod
def get_latest_by(cls, **kwargs):
# TODO: need to sort on 'round' since actions will not be globally sync'd.
return cls.query.filter_by(**kwargs).order_by(ActionRecord.id.desc()).first()
class ActionRecord(Entity):
@classmethod
def get_latest_by(cls, **kwargs):
# TODO: need to sort on 'round' since actions will not be globally sync'd.
return cls.query.filter_by(**kwargs).order_by(ActionRecord.id.desc()).first()
-# ACCOUNTING
+ @classmethod
+ def delete_recent_by(cls, since, **kwargs):
+ acts = cls.query.filter_by(**kwargs).filter(cls.date_created >= datetime.now() - timedelta(since)).order_by(cls.date_created.desc())
+ for i in acts: i.delete()
+
+ # ACCOUNTING
date_created = Field(DateTime,default=datetime.now)
loginbase = Field(String,default=None)
hostname = Field(String,default=None)
date_created = Field(DateTime,default=datetime.now)
loginbase = Field(String,default=None)
hostname = Field(String,default=None)
@@
-107,6
+117,8
@@
class ActionRecord(Entity):
# NOTE: in case an exception is thrown while trying to perform an action.
error_string = Field(String, default=None)
# NOTE: in case an exception is thrown while trying to perform an action.
error_string = Field(String, default=None)
+ log_path = Field(String, default=None)
+
#issue = ManyToOne('IssueRecord')
# NOTE: this is the parent relation to fb records. first create the
# action record, then append to this value all of the findbad records we
#issue = ManyToOne('IssueRecord')
# NOTE: this is the parent relation to fb records. first create the
# action record, then append to this value all of the findbad records we