Skip to content

Commit

Permalink
Merge pull request #9234 from Azure/v-mchatla/skipTestEvent
Browse files Browse the repository at this point in the history
Oracle Cloud Infrastructure - Added check to skip Test events
  • Loading branch information
v-dvedak authored Oct 18, 2023
2 parents 5d8bf73 + 9e86d4c commit a6a05ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,26 @@ def process_events(client: oci.streaming.StreamClient, stream_id, initial_cursor
if message:
event = b64decode(message.value.encode()).decode()
logging.info('event details {}'.format(event))
event = json.loads(event)
if "data" in event:
if "request" in event["data"] and event["type"] != "com.oraclecloud.loadbalancer.access":
if event["data"]["request"] is not None and "headers" in event["data"]["request"]:
event["data"]["request"]["headers"] = json.dumps(event["data"]["request"]["headers"])
if event["data"]["request"] is not None and "parameters" in event["data"]["request"]:
event["data"]["request"]["parameters"] = json.dumps(
event["data"]["request"]["parameters"])
if "response" in event["data"]:
if event["data"]["response"] is not None and "headers" in event["data"]["response"]:
event["data"]["response"]["headers"] = json.dumps(event["data"]["response"]["headers"])
if "additionalDetails" in event["data"]:
event["data"]["additionalDetails"] = json.dumps(event["data"]["additionalDetails"])
if "stateChange" in event["data"]:
logging.info("In data.stateChange : {}".format(event["data"]["stateChange"]))
if event["data"]["stateChange"] is not None and "current" in event["data"]["stateChange"] :
event["data"]["stateChange"]["current"] = json.dumps(
event["data"]["stateChange"]["current"])
sentinel.send(event)
if event != 'Test':
event = json.loads(event)
if "data" in event:
if "request" in event["data"] and event["type"] != "com.oraclecloud.loadbalancer.access":
if event["data"]["request"] is not None and "headers" in event["data"]["request"]:
event["data"]["request"]["headers"] = json.dumps(event["data"]["request"]["headers"])
if event["data"]["request"] is not None and "parameters" in event["data"]["request"]:
event["data"]["request"]["parameters"] = json.dumps(
event["data"]["request"]["parameters"])
if "response" in event["data"]:
if event["data"]["response"] is not None and "headers" in event["data"]["response"]:
event["data"]["response"]["headers"] = json.dumps(event["data"]["response"]["headers"])
if "additionalDetails" in event["data"]:
event["data"]["additionalDetails"] = json.dumps(event["data"]["additionalDetails"])
if "stateChange" in event["data"]:
logging.info("In data.stateChange : {}".format(event["data"]["stateChange"]))
if event["data"]["stateChange"] is not None and "current" in event["data"]["stateChange"] :
event["data"]["stateChange"]["current"] = json.dumps(
event["data"]["stateChange"]["current"])
sentinel.send(event)

sentinel.flush()
if check_if_script_runs_too_long(start_ts):
Expand Down
Binary file not shown.

0 comments on commit a6a05ea

Please sign in to comment.