Housekeeping and migrated prints to logging
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
from core.runtime.applyconditions import applyConditions
|
||||
|
||||
def buildFirewall(listener, outputs):
|
||||
firewall_log = os.environ.get("LOGS_FIREWALL", "false").lower() == "true"
|
||||
#firewall_log = os.environ.get("LOGS_FIREWALL", "false").lower() == "true"
|
||||
firewall_log = True
|
||||
|
||||
status_code = 200
|
||||
outputs["firewall_allowed"] = []
|
||||
@@ -13,20 +15,24 @@ def buildFirewall(listener, outputs):
|
||||
|
||||
if match:
|
||||
status_code = filter.get("status_code", 200)
|
||||
if firewall_log:
|
||||
logging.info(filter.get("print"))
|
||||
logging.info(f"Returning status_code: {status_code}")
|
||||
continue
|
||||
|
||||
#This needs to be moved into definitions but until logic is put in place it lives here.
|
||||
if "com.loxthelion.rmass_message_id" in item.get("content", {}):
|
||||
status_code = 200
|
||||
print("Excluding previously imported items")
|
||||
print(f"Returning status_code: {status_code}")
|
||||
if firewall_log:
|
||||
logging.info("Excluding previously imported items")
|
||||
logging.info(f"Returning status_code: {status_code}")
|
||||
|
||||
continue
|
||||
|
||||
outputs["firewall_allowed"].append(item)
|
||||
|
||||
if outputs["firewall_allowed"]:
|
||||
return True, outputs, status_code
|
||||
if outputs["firewall_allowed"] != []:
|
||||
return True, status_code
|
||||
|
||||
#Needs to be present to prevent TypeError
|
||||
return False, outputs, status_code
|
||||
return False, status_code
|
||||
Reference in New Issue
Block a user