ceph: mgr-restful-plugin pid file issues

mgr-restful-plugin is writing service pid to associated pid file
but does not flush or close the file descriptor.

When SM tris to read the pid number from pid file it fails because
the file exists but it's empty.

Flush pid file after writing pid value.

Closes-Bug: 1836897
Change-Id: If34293719f330d89c150fff8491c40a08581a58b
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
This commit is contained in:
Daniel Badea 2019-07-17 12:48:26 +00:00 committed by dbadea
parent 97f7cb4a58
commit bc4bebfb92

View File

@ -488,6 +488,7 @@ class ServiceMonitor(object):
try:
pid_file = open(CONFIG.service_pid_file, 'w')
pid_file.write(str(os.getpid()))
pid_file.flush()
except OSError as err:
raise ServiceNoPidFile(
path=CONFIG.service_pid_file, reason=str(err))