Merge pull request #180778 from martinetd/logrotate-test-nosandbox
logrotate: fix config check without sandbox
This commit is contained in:
commit
9209b23d44
1 changed files with 6 additions and 5 deletions
|
@ -167,22 +167,23 @@ let
|
||||||
sed -e "s/\bsu\s.*/su $user $group/" \
|
sed -e "s/\bsu\s.*/su $user $group/" \
|
||||||
-e "s/\b\(create\s\+[0-9]*\s*\|createolddir\s\+[0-9]*\s\+\).*/\1$user $group/" \
|
-e "s/\b\(create\s\+[0-9]*\s*\|createolddir\s\+[0-9]*\s\+\).*/\1$user $group/" \
|
||||||
-e "1imissingok" -e "s/\bnomissingok\b//" \
|
-e "1imissingok" -e "s/\bnomissingok\b//" \
|
||||||
$out > /tmp/logrotate.conf
|
$out > logrotate.conf
|
||||||
# Since this makes for very verbose builds only show real error.
|
# Since this makes for very verbose builds only show real error.
|
||||||
# There is no way to control log level, but logrotate hardcodes
|
# There is no way to control log level, but logrotate hardcodes
|
||||||
# 'error:' at common log level, so we can use grep, taking care
|
# 'error:' at common log level, so we can use grep, taking care
|
||||||
# to keep error codes
|
# to keep error codes
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
if ! ${pkgs.buildPackages.logrotate}/sbin/logrotate --debug /tmp/logrotate.conf 2>&1 \
|
if ! ${pkgs.buildPackages.logrotate}/sbin/logrotate -s logrotate.status \
|
||||||
| ( ! grep "error:" ) > /tmp/logrotate-error; then
|
--debug logrotate.conf 2>&1 \
|
||||||
|
| ( ! grep "error:" ) > logrotate-error; then
|
||||||
echo "Logrotate configuration check failed."
|
echo "Logrotate configuration check failed."
|
||||||
echo "The failing configuration (after adjustments to pass tests in sandbox) was:"
|
echo "The failing configuration (after adjustments to pass tests in sandbox) was:"
|
||||||
printf "%s\n" "-------"
|
printf "%s\n" "-------"
|
||||||
cat /tmp/logrotate.conf
|
cat logrotate.conf
|
||||||
printf "%s\n" "-------"
|
printf "%s\n" "-------"
|
||||||
echo "The error reported by logrotate was as follow:"
|
echo "The error reported by logrotate was as follow:"
|
||||||
printf "%s\n" "-------"
|
printf "%s\n" "-------"
|
||||||
cat /tmp/logrotate-error
|
cat logrotate-error
|
||||||
printf "%s\n" "-------"
|
printf "%s\n" "-------"
|
||||||
echo "You can disable this check with services.logrotate.checkConfig = false,"
|
echo "You can disable this check with services.logrotate.checkConfig = false,"
|
||||||
echo "but if you think it should work please report this failure along with"
|
echo "but if you think it should work please report this failure along with"
|
||||||
|
|
Loading…
Reference in a new issue