Skip to content

Commit e3f0bdf

Browse files
liuh-80mssonicbld
authored andcommitted
Fix TACACS accounting UT issue caused by auditd log rotate (#11710)
Fix TACACS accounting UT issue caused by auditd log rotate ### Description of PR Fix TACACS accounting UT issue caused by auditd log rotate ##### Work item tracking - Microsoft ADO: 26710599 ### Type of change - [x] Bug fix - [ ] Testbed and Framework(new/improvement) - [] Test case(new/improvement) ## Approach #### What is the motivation for this PR? Fix TACACS accounting UT issue caused by auditd log rotate. There are 2 code issue: 1. when auditd log rotate, some auditd log will missing from output of 'service auditd status' 1. duthost.command() can only run 1 command, so can't handle piping output to grep #### How did you do it? show auditd log with 'sudo journalctl -u auditd --boot' and run command with duthost.shell() to support grep. #### How did you verify/test it? Pass all UT
1 parent 22b238f commit e3f0bdf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/tacacs/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def check_server_received(ptfhost, data):
315315

316316

317317
def get_auditd_config_reload_timestamp(duthost):
318-
res = duthost.command("sudo service auditd status | grep 'audisp-tacplus re-initializing configuration'")
318+
res = duthost.shell("sudo journalctl -u auditd --boot | grep 'audisp-tacplus re-initializing configuration'")
319319
logger.info("aaa config file timestamp {}".format(res["stdout_lines"]))
320320

321321
if len(res["stdout_lines"]) == 0:

0 commit comments

Comments
 (0)