projects
/
osm
/
LCM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LCM Creates health check file according to configuration storage path
[osm/LCM.git]
/
osm_lcm
/
lcm.py
diff --git
a/osm_lcm/lcm.py
b/osm_lcm/lcm.py
index
d6c10e8
..
5f630b2
100644
(file)
--- a/
osm_lcm/lcm.py
+++ b/
osm_lcm/lcm.py
@@
-44,6
+44,7
@@
from osm_common.fsbase import FsException
from osm_common.msgbase import MsgException
from osm_lcm.data_utils.database.database import Database
from osm_lcm.data_utils.filesystem.filesystem import Filesystem
from osm_common.msgbase import MsgException
from osm_lcm.data_utils.database.database import Database
from osm_lcm.data_utils.filesystem.filesystem import Filesystem
+from osm_lcm.lcm_hc import get_health_check_file
from os import environ, path
from random import choice as random_choice
from n2vc import version as n2vc_version
from os import environ, path
from random import choice as random_choice
from n2vc import version as n2vc_version
@@
-58,9
+59,6
@@
min_RO_version = "6.0.2"
min_n2vc_version = "0.0.2"
min_common_version = "0.1.19"
min_n2vc_version = "0.0.2"
min_common_version = "0.1.19"
-health_check_file = (
- path.expanduser("~") + "/time_last_ping"
-) # TODO find better location for this file
class Lcm:
class Lcm:
@@
-98,6
+96,7
@@
class Lcm:
# load configuration
config = self.read_config_file(config_file)
self.config = config
# load configuration
config = self.read_config_file(config_file)
self.config = config
+ self.health_check_file = get_health_check_file(self.config)
self.config["ro_config"] = {
"ng": config["RO"].get("ng", False),
"uri": config["RO"].get("uri"),
self.config["ro_config"] = {
"ng": config["RO"].get("ng", False),
"uri": config["RO"].get("uri"),
@@
-345,12
+344,12
@@
class Lcm:
return
self.pings_not_received = 0
try:
return
self.pings_not_received = 0
try:
- with open(health_check_file, "w") as f:
+ with open(
self.
health_check_file, "w") as f:
f.write(str(time()))
except Exception as e:
self.logger.error(
"Cannot write into '{}' for healthcheck: {}".format(
f.write(str(time()))
except Exception as e:
self.logger.error(
"Cannot write into '{}' for healthcheck: {}".format(
- health_check_file, e
+
self.
health_check_file, e
)
)
return
)
)
return
@@
-878,7
+877,7
@@
if __name__ == "__main__":
elif o == "--health-check":
from osm_lcm.lcm_hc import health_check
elif o == "--health-check":
from osm_lcm.lcm_hc import health_check
- health_check(
health_check
_file, Lcm.ping_interval_pace)
+ health_check(
config
_file, Lcm.ping_interval_pace)
# elif o == "--log-socket-port":
# log_socket_port = a
# elif o == "--log-socket-host":
# elif o == "--log-socket-port":
# log_socket_port = a
# elif o == "--log-socket-host":