projects
/
osm
/
POL.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix(healthcheck): new flag implemented as a file for health checking in POL (it only...
[osm/POL.git]
/
osm_policy_module
/
core
/
agent.py
diff --git
a/osm_policy_module/core/agent.py
b/osm_policy_module/core/agent.py
index
34b852a
..
3f87d16
100644
(file)
--- a/
osm_policy_module/core/agent.py
+++ b/
osm_policy_module/core/agent.py
@@
-23,6
+23,8
@@
##
import asyncio
import logging
##
import asyncio
import logging
+from pathlib import Path
+import os
import peewee
import peewee
@@
-52,14
+54,18
@@
class PolicyModuleAgent:
self.loop.run_until_complete(self.start())
async def start(self):
self.loop.run_until_complete(self.start())
async def start(self):
+ Path('/tmp/osm_pol_agent_health_flag').touch()
topics = [
"ns",
"alarm_response"
]
await self.msg_bus.aioread(topics, self._process_msg)
log.critical("Exiting...")
topics = [
"ns",
"alarm_response"
]
await self.msg_bus.aioread(topics, self._process_msg)
log.critical("Exiting...")
+ if os.path.exists('/tmp/osm_pol_agent_health_flag'):
+ os.remove('/tmp/osm_pol_agent_health_flag')
async def _process_msg(self, topic, key, msg):
async def _process_msg(self, topic, key, msg):
+ Path('/tmp/osm_pol_agent_health_flag').touch()
log.debug("_process_msg topic=%s key=%s msg=%s", topic, key, msg)
try:
if key in ALLOWED_KAFKA_KEYS:
log.debug("_process_msg topic=%s key=%s msg=%s", topic, key, msg)
try:
if key in ALLOWED_KAFKA_KEYS: