Skip to content

Commit

Permalink
[config] Reset failed status of all SONiC services, whether or not th…
Browse files Browse the repository at this point in the history
…ey are currently failed (#619)
  • Loading branch information
jleveque committed Sep 12, 2019
1 parent da5cc8c commit b943d67
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit b943d67

Please sign in to comment.