MCPcopy Create free account
hub / github.com/adobe/Marinus / set_status

Method set_status

python3_cron_scripts/libs3/ZoneManager.py:218–245  ·  view source on GitHub ↗

Set a zone to expired.

(self, zone, status, caller)

Source from the content-addressed store, hash-verified

216 return zones
217
218 def set_status(self, zone, status, caller):
219 """
220 Set a zone to expired.
221 """
222 count = self.mongo_connector.perform_count(self.zone_collection, {"zone": zone})
223 if count == 0:
224 self._logger.error("ERROR: Invalid zone!")
225 return
226
227 if (
228 status != ZoneManager.EXPIRED
229 and status != ZoneManager.FALSE_POSITIVE
230 and status != ZoneManager.CONFIRMED
231 and status != ZoneManager.UNCONFIRMED
232 ):
233 self._logger.error("ERROR: Bad status value!")
234 return
235
236 if caller is None or caller == "":
237 self._logger.error("ERROR: Please provide a caller value!")
238 return
239
240 now = datetime.now()
241 note = caller + " set to " + status + " on " + str(now)
242 self.zone_collection.update_one(
243 {"zone": zone},
244 {"$set": {"status": status, "updated": now}, "$addToSet": {"notes": note}},
245 )
246
247 def add_note(self, zone, note):
248 """

Callers 2

mainFunction · 0.95

Calls 1

perform_countMethod · 0.80

Tested by

no test coverage detected