CentOS/RH support for jenkins-sudo-grep.sh script.

* modules/jenkins/files/slave_scripts/jenkins-sudo-grep.sh: The log
file names and sudo error patterns are different in RHEL and CentOS
than in Debian and Ubuntu, so this leverages puppet's facter utility
to determine which OS family is in use and look in the correct place
for the correct error message.

Change-Id: Iaf3bbc60e408bac575d3724fb6181a5976c8004f
Reviewed-on: https://review.openstack.org/28649
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Khai Do <zaro0508@gmail.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Jeremy Stanley 2013-05-09 02:02:03 +00:00 committed by Jenkins
parent 37e88867a8
commit 0ae2078416

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -15,11 +16,20 @@
# under the License.
# Find out if jenkins has attempted to run any sudo commands by checking
# the auth.log file before and after a test run.
# the auth.log or secure log files before and after a test run.
PATTERN="sudo.*jenkins.*:.*incorrect password attempts"
OLDLOGFILE=/var/log/auth.log.1
LOGFILE=/var/log/auth.log
case $( facter osfamily ) in
Debian)
PATTERN="sudo.*jenkins.*:.*incorrect password attempts"
OLDLOGFILE=/var/log/auth.log.1
LOGFILE=/var/log/auth.log
;;
RedHat)
PATTERN="sudo.*jenkins.*:.*command not allowed"
OLDLOGFILE=$( ls /var/log/secure-* | sort | tail -n1 )
LOGFILE=/var/log/secure
;;
esac
case "$1" in
pre)