Added debug log when renewing TTLs for ease of debugging TTL issues

This commit is contained in:
Shay Nehmad 2019-07-21 17:59:43 +03:00
parent 30dcce4be2
commit b1cb56d13f
1 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@
Define a Document Schema for the Monkey document.
"""
import mongoengine
import logging
from mongoengine import Document, StringField, ListField, BooleanField, EmbeddedDocumentField, ReferenceField, \
DateTimeField
@ -9,6 +10,8 @@ from monkey_island.cc.models.monkey_ttl import MonkeyTtl, create_monkey_ttl_docu
from monkey_island.cc.consts import DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS
logger = logging.getLogger(__name__)
class Monkey(Document):
"""
This class has 2 main section:
@ -79,6 +82,7 @@ class Monkey(Document):
return os
def renew_ttl(self, duration=DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS):
logger.debug("Renewing TTL for monkey {0}".format(self.guid))
self.ttl_ref = create_monkey_ttl_document(duration)