Fixing minor issues in *ComponentLogs keywords
Change-Id: I9140edac7db4e644e18b79c6e54294fb96cf68a0
diff --git a/vars/startComponentsLogs.groovy b/vars/startComponentsLogs.groovy
index 954d0b1..4cea1d2 100644
--- a/vars/startComponentsLogs.groovy
+++ b/vars/startComponentsLogs.groovy
@@ -47,7 +47,7 @@
def tag = "${tagPrefix}-kail-${logFile}"
println "Starting logging process for label: ${label}"
sh """
- _TAG=${tag} kail -l ${label} --since 1h > ${logsDir}/${logFile}.log&
+ _TAG=${tag} kail -l ${label} --since 1h > ${cfg.logsDir}/${logFile}.log&
"""
}
}
diff --git a/vars/stopComponentsLogs.groovy b/vars/stopComponentsLogs.groovy
index fc0f0e9..24d2ad7 100644
--- a/vars/stopComponentsLogs.groovy
+++ b/vars/stopComponentsLogs.groovy
@@ -7,19 +7,25 @@
compress: false, // wether to compress the logs in a tgz file
]
+ if (!config) {
+ config = [:]
+ }
+
+ def cfg = defaultConfig + config
+
def tag = "jenkins-"
println "Stopping all kail logging process"
sh """
- P_IDS="$(ps e -ww -A | grep "_TAG=jenkins-kail" | grep -v grep | awk '{print $1}')"
- if [ -n "$P_IDS" ]; then
- for P_ID in $P_IDS; do
- kill -9 $P_ID
+ P_IDS="\$(ps e -ww -A | grep "_TAG=jenkins-kail" | grep -v grep | awk '{print \$1}')"
+ if [ -n "\$P_IDS" ]; then
+ for P_ID in \$P_IDS; do
+ kill -9 \$P_ID
done
fi
"""
- if (compress) {
+ if (cfg.compress) {
sh """
- tar czf ${logsDir}/combined.tgz *
+ tar czf ${cfg.logsDir}/combined.tgz *
rm *.log
"""