Skip to content

Commit

Permalink
[generic_config_updater] Minor update - No logical code change (sonic…
Browse files Browse the repository at this point in the history
…-net#2028)

What I did
Missed update from review comments in PR sonic-net#2020
s/os.system("sleep 10s")/time.sleep(10)/
  • Loading branch information
renukamanavalan authored Jan 20, 2022
1 parent 4f2773c commit ad1ed4e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion generic_config_updater/services_validator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import time
from .gu_common import genericUpdaterLogging

logger = genericUpdaterLogging.get_logger(title="Service Validator")
Expand Down Expand Up @@ -33,7 +34,7 @@ def _service_restart(svc_name):
logger.log(logger.LOG_PRIORITY_ERROR,
f"Restart failed for {svc_name} rc={rc} after reset; Pause for 10s & retry",
print_to_console)
os.system("sleep 10s")
time.sleep(10)
rc = os.system(f"systemctl restart {svc_name}")

if rc == 0:
Expand Down
1 change: 0 additions & 1 deletion tests/generic_config_updater/service_validator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def mock_os_system_call(cmd):
{ "cmd": "systemctl restart rsyslog", "rc": 1 }, # rsyslog restart; fails
{ "cmd": "systemctl reset-failed rsyslog", "rc": 1 }, # reset; failure here just logs
{ "cmd": "systemctl restart rsyslog", "rc": 1 }, # restart again; fails
{ "cmd": "sleep 10s", "rc": 0 }, # sleep; rc ignored
{ "cmd": "systemctl restart rsyslog", "rc": 1 }, # restart again; fails
]

Expand Down

0 comments on commit ad1ed4e

Please sign in to comment.