Skip to content

Commit

Permalink
[Event-listener] Use the syslog.LOG_ERR to write message into syslog
Browse files Browse the repository at this point in the history
file.

Signed-off-by: Yong Zhao <[email protected]>
  • Loading branch information
yozhao101 committed Feb 3, 2020
1 parent 0833a03 commit 56ed262
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions files/scripts/supervisor-proc-exit-listener
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main(argv):
container_name = arg

if not container_name:
syslog.syslog(syslog.LOG_ERROR, "Container name not specified. Exiting...")
syslog.syslog(syslog.LOG_ERR, "Container name not specified. Exiting...")
sys.exit(1)

# Read the list of critical processes from a file
Expand Down Expand Up @@ -56,16 +56,16 @@ def main(argv):
config_db.connect()
container_features_table = config_db.get_table(CONTAINER_FEATURE_TABLE_NAME)
if not container_features_table:
syslog.syslog(syslog.LOG_ERROR, "Unable to retrieve container features table from Config DB. Exiting...")
syslog.syslog(syslog.LOG_ERR, "Unable to retrieve container features table from Config DB. Exiting...")
sys.exit(2)

if not container_features_table.has_key(container_name):
syslog.syslog(syslog.LOG_ERROR, "Unable to retrieve features for container '{}'. Exiting...".format(container_name))
syslog.syslog(syslog.LOG_ERR, "Unable to retrieve features for container '{}'. Exiting...".format(container_name))
sys.exit(3)

restart_feature = container_features_table[container_name].get('auto_restart')
if not restart_feature:
syslog.syslog(syslog.LOG_ERROR, "Unable to determine auto-restart feature status for container '{}'. Exiting...".format(container_name))
syslog.syslog(syslog.LOG_ERR, "Unable to determine auto-restart feature status for container '{}'. Exiting...".format(container_name))
sys.exit(4)

# If auto-restart feature is enabled and a critical process exited unexpectedly, terminate supervisor
Expand Down

0 comments on commit 56ed262

Please sign in to comment.