From 0602a3bc83f4ed61b9de09d3c902a31901c44b1c Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Tue, 7 May 2019 11:51:17 +0300 Subject: [PATCH] Renamed collection from TTL to MonkeyTTL --- monkey/monkey_island/cc/models/monkey.py | 8 ++++---- monkey/monkey_island/cc/resources/monkey.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/models/monkey.py b/monkey/monkey_island/cc/models/monkey.py index d54fe1b43..73f924847 100644 --- a/monkey/monkey_island/cc/models/monkey.py +++ b/monkey/monkey_island/cc/models/monkey.py @@ -22,7 +22,7 @@ class Config(EmbeddedDocument): class Creds(EmbeddedDocument): """ - TODO get an example of this data + TODO get an example of this data, and make it strict """ meta = {'strict': False} pass @@ -36,7 +36,7 @@ class PbaResults(EmbeddedDocument): result = ListField() -class Ttl(Document): +class MonkeyTtl(Document): meta = { 'indexes': [ { @@ -72,7 +72,7 @@ class Monkey(Document): config_error = BooleanField() critical_services = ListField(StringField()) pba_results = ListField() - ttl_ref = ReferenceField(Ttl) + ttl_ref = ReferenceField(MonkeyTtl) def is_dead(self): monkey_is_dead = False @@ -80,7 +80,7 @@ class Monkey(Document): monkey_is_dead = True else: try: - if Ttl.objects(id=self.ttl_ref.id).count() == 0: + if MonkeyTtl.objects(id=self.ttl_ref.id).count() == 0: # No TTLs - monkey has timed out. The monkey is MIA monkey_is_dead = True except mongoengine.DoesNotExist: diff --git a/monkey/monkey_island/cc/resources/monkey.py b/monkey/monkey_island/cc/resources/monkey.py index c6e7af908..ace843c85 100644 --- a/monkey/monkey_island/cc/resources/monkey.py +++ b/monkey/monkey_island/cc/resources/monkey.py @@ -48,7 +48,7 @@ class Monkey(flask_restful.Resource): tunnel_host_ip = monkey_json['tunnel'].split(":")[-2].replace("//", "") NodeService.set_monkey_tunnel(monkey["_id"], tunnel_host_ip) - current_ttl = models.monkey.Ttl(expire_at=datetime.now() + timedelta(seconds=30)) + current_ttl = models.monkey.MonkeyTtl(expire_at=datetime.now() + timedelta(seconds=30)) current_ttl.save() update['$set']['ttl_ref'] = current_ttl.id