Bug 632846 - sa-update.cron needs better status, configurability
Summary: sa-update.cron needs better status, configurability
Alias: None
Product: Fedora
Classification: Fedora
Component: spamassassin
Version: 13
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Warren Togami
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-09-11 11:51 UTC by tlhackque
Modified: 2010-11-06 23:48 UTC (History)
5 users (show)

Fixed In Version: spamassassin-3.3.2-0.2.svn1027144.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-11-06 23:48:23 UTC
Type: ---

Attachments (Terms of Use)
Patch to provide requested features (2.30 KB, application/octet-stream)
2010-09-11 11:51 UTC, tlhackque
no flags Details

Description tlhackque 2010-09-11 11:51:13 UTC
Created attachment 446655 [details]
Patch to provide requested features

Description of problem:

The spamassassin package installs /etc/cron.d/sa-update and /usr/share/spamassassin/sa-update.cron to automatically update the rulesets.

1) There is no way to disable the automatic update without touching a 'do not edit' file

2) The log file created by the cron job isn't very useful

3) There is no mechanism to obtain notification of successful ruleset updates.  

4) For people who want to call sa-update.cron from another script (such as bayes training), it would be useful if valid exit status were produced.

The attached patch addresses these issues.

/etc/sysconfig/sa-update controls all features:

SAUPDATE can take the value "no".  This will cause the script to exit without looking for any running daemons.

OPTIONS will be passed to sa-update - this can be used to pass -D (debug) or other local choices without having to edit the script.

NOTIFY_UPD=yes will cause cron to send mail when an update is successfully applied.

DEBUG=yes will also cause cron to send mail when no update is available

Any other exit status will be translated to text and unconditionally sent as mail.  These are all failures that require attention.

Finally, all exit status are timestamped and logged as text in /var/log/sa-update.log, and used as the script's exit status.

Version-Release number of selected component (if applicable):

spamassassin.x86_64                      3.3.1-2.fc13

Comment 1 Kevin Fenzi 2010-09-25 19:49:02 UTC
This looks pretty nice from a quick glance here. 

Don't we need to add /var/log/sa-update.log to logrotate however? Or it will just grow without bound. 

When DEBUG is set, perhaps add -v to sa-update to note what exact channels were updated?
Or might that be worth doing all the time for the log?

Comment 2 tlhackque 2010-09-25 20:51:17 UTC
Thanks for your review.

1) /etc/logrotate.d/sa-update already exists and covers this log.  (It's not a new log - it's that it never had any useful content before.)  Here's the file as it was installed on my system:
/var/log/sa-update.log {
I don't think that the improved logging will require changes to logrotate...

2) Sure, you could add -v to sa-update under DEBUG.  [ -n "$DEBUG" ] && OPTIONS="$OPTIONS -v".  But if you're editing the sysconfig file, you could just as easily add -v to the OPTIONS... I don't have a strong opinion on this.

It would be harder to do something different for the log from what gets mailed.  You'd have to do something like a sed filter; maybe even changes to sa-update to get everything on stdout/err as appropriate.  I didn't look into that; I think going this way would be overkill.

Comment 3 Kevin Fenzi 2010-10-06 20:31:19 UTC
Ah right. Sounds good. 

Do you have a sample /etc/sysconfig/sa-update file as well? 
Or shall I whip one up here?

I don't have any further objections personally...

Comment 4 tlhackque 2010-10-06 21:45:15 UTC
/etc/sysconfig/sa-update is already distributed, but of course didn't describe the options added by this patch.

To document all the options, that could be replaced with this:

# sa-update configuration
# Note that the opposite of "yes" is the empty string, NOT "no"

# Don't run sa-update even if it's in /etc/cron.d/ - as installed

# Run sa-update even if no daemon is detected

# Default: Run only if a daemon is detected

# Options for the actual sa-update command
# These are added to the channel configuration from /etc/mail/spamassassin/channel.d/*.conf

# Debug script - send mail even if no update available
# DEBUG=yes

# Send mail when updates successfully processed
# Default: send mail only on error

Comment 5 Fedora Update System 2010-10-25 18:13:53 UTC
spamassassin-3.3.2-0.1.svn1027144.fc14 has been submitted as an update for Fedora 14.

Comment 6 Fedora Update System 2010-10-28 05:50:53 UTC
spamassassin-3.3.2-0.1.svn1027144.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update spamassassin'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/spamassassin-3.3.2-0.1.svn1027144.fc14

Comment 7 Jonathan Kamens 2010-10-29 12:31:25 UTC
/etc/sysconfig/sa-update is broken. Negative karma filed.

Comment 8 Jonathan Kamens 2010-10-29 12:32:11 UTC
Sorry, I should have given details... Line 15 is supposed to be a comment but isn't properly commented.

Comment 9 tlhackque 2010-10-29 13:39:37 UTC
Looks like bugzilla wrapped with a hard return; 'from ' and '/etc...' were on the same line when I provided the sample...

Comment 10 Kevin Fenzi 2010-10-29 16:08:13 UTC
Yeah. ;( 

Fixed and pushed a new build. Can you re-test and re-add karma?

Comment 11 Matthias Runge 2010-11-04 11:40:02 UTC
I can confirm, the new build fixes (at least the issue from comment #7 ff)

Comment 12 Nick Bebout 2010-11-04 20:54:40 UTC
Update has been created in bodhi, can you please test spamassassin-3.3.2-0.2.svn1027144.fc14 and provide karma in bodhi if this fixes your issue?  If we get 2 more positive karma we can go ahead and push it to stable.

Comment 13 Fedora Update System 2010-11-05 22:54:43 UTC
spamassassin-3.3.2-0.2.svn1027144.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update spamassassin'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/spamassassin-3.3.2-0.2.svn1027144.fc14

Comment 14 Fedora Update System 2010-11-06 23:48:07 UTC
spamassassin-3.3.2-0.2.svn1027144.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.