removing erroneous WatchList list instantiation, changing db reference to watchentries.

This commit is contained in:
Phrozyn 2019-01-08 12:48:03 -06:00
Родитель 9c53efb7a1
Коммит fb7bc08424
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: DBCDDDC9CF758282
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -549,15 +549,15 @@ def getWatchlist():
# connect to mongo
client = MongoClient(options.mongohost, options.mongoport)
mozdefdb = client.meteor
watchlist = mozdefdb['watchlist']
watchlistentries = mozdefdb['watchlist']
# Log the entries we are removing to maintain an audit log
expired = watchlist.find({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
expired = watchlistentries.find({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
for entry in expired:
sys.stdout.write('Deleting entry {0} from watchlist /n'.format(entry))
# delete any that expired
watchlist.delete_many({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
watchlistentries.delete_many({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
# Lastly, export the combined watchlist
watchCursor=mozdefdb['watchlist'].aggregate([
@ -571,7 +571,6 @@ def getWatchlist():
},
{"$project":{"watchcontent":1}},
])
WatchList=[]
for content in watchCursor:
WatchList.append(
content['watchcontent']