Prune archive journal log
There is a case seen on system where the journal had filled up
the /run/ filesystem. Apparently we don’t prune that yet in code
for cleanup.
Command Example : "journalctl —vacuum-size=1M"
Defaulted to 1 Meg in the utils.robot.
Resolves openbmc/openbmc-test-automation#231
Change-Id: I93fa162a77b24ce06926ee3ddf485520a90e5e11
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 7cb0ad7..6c8099c 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -501,3 +501,21 @@
... return_stderr=True return_rc=True
Should Be True ${count}==0
Should Be Empty ${stderr}
+
+Prune Journal Log
+ [Documentation] Prune archived journal logs.
+ [Arguments] ${vacuum_size}=1M
+
+ # This keyword can be used to prevent the journal
+ # log from filling up the /run filesystem.
+ # This command will retain only the latest logs
+ # of the user specified size.
+
+ Open Connection And Log In
+ ${output} ${stderr} ${rc}=
+ ... Execute Command
+ ... journalctl --vacuum-size=${vacuum_size}
+ ... return_stderr=True return_rc=True
+
+ Should Be Equal ${rc} ${0} msg=${stderr}
+ Should Contain ${stderr} Vacuuming done