From b943d67d978790a6ae0e4c15f856291268930e0b Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 12 Sep 2019 11:00:47 -0700 Subject: [PATCH] [config] Reset failed status of all SONiC services, whether or not they are currently failed (#619) --- config/main.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/config/main.py b/config/main.py index 95730cd9e365..1cb497210f56 100755 --- a/config/main.py +++ b/config/main.py @@ -347,19 +347,13 @@ def _reset_failed_services(): 'teamd' ] - command = "systemctl --failed | grep failed | awk '{ print $2 }' | awk -F'.' '{ print $1 }'" - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) - (out, err) = proc.communicate() - failed_services = out.rstrip('\n').split('\n') - - for service in failed_services: - if service in services_to_reset: - try: - click.echo("Resetting failed service {} ...".format(service)) - run_command("systemctl reset-failed {}".format(service)) - except SystemExit as e: - log_error("Failed to reset service {}".format(service)) - raise + for service in services_to_reset: + try: + click.echo("Resetting failed status for service {} ...".format(service)) + run_command("systemctl reset-failed {}".format(service)) + except SystemExit as e: + log_error("Failed to reset failed status for service {}".format(service)) + raise def _restart_services(): services_to_restart = [