Skip to content

Commit

Permalink
[TACACS] Handle log rotate failed issue (sonic-net#12821)
Browse files Browse the repository at this point in the history
Handle log rotate failed issue

#### Why I did it
sonic test_ro_disk test case failed because log rotate command failed.

#### How I did it
Ignore log rotate failed because log already rotating

#### How to verify it
Pass all test case.

#### Description for the changelog
Handle log rotate failed issue
  • Loading branch information
liuh-80 authored and mssonicbld committed May 15, 2024
1 parent ca6d675 commit 17f198e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/tacacs/test_ro_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,14 @@ def test_ro_disk(localhost, ptfhost, duthosts, enum_rand_one_per_hwsku_hostname,
duthost.copy(src=conf_path, dest="/etc/rsyslog.d/000-ro_disk.conf")

# To get file in decent size. Force a rotate
duthost.shell("logrotate --force /etc/logrotate.d/rsyslog")
try:
duthost.shell("logrotate --force /etc/logrotate.d/rsyslog")
except RunAnsibleModuleFail as e:
if "logrotate does not support parallel execution on the same set of logfiles" in e.message:
# command will failed when log already in rotating
logger.warning("logrotate command failed: {}".format(e))
else:
raise e

res = duthost.shell("systemctl restart rsyslog")
assert res["rc"] == 0, "failed to restart rsyslog"
Expand Down

0 comments on commit 17f198e

Please sign in to comment.