Add support for recording to and running from file
ClosedPublic

Authored by mkrizek on May 22 2014, 3:45 PM.

Details

Summary

We'd need to use logrotate for the log file. Readme will be updated once this solution gets commented and/or reviewed.

Fixes T173

Test Plan

Func test included.

Run 'cli.py -f file', where file is in csv format, e.g.:

'time;rpmlint;koji_build;xchat-2.8.8-21.fc20;x86_64'
'time;upgradepath;bodhi_id;xchat-2.8.8-21.fc20;x86_64'

Diff Detail

Repository
rTRGR taskotron-trigger
Lint
Lint Skipped
Unit
Unit Tests Skipped

The other possibility is to somehow reuse /var/log/fedmsg.d/ logs which would be difficult to parse unless we change the format.

tflink requested changes to this revision.May 22 2014, 6:35 PM

The other possibility is to somehow reuse /var/log/fedmsg.d/ logs which would be difficult to parse unless we change the format.

I agree that the csv approach is better for our uses.

If the CLI is going to be distributed with the package (and I assume it is), the specfile needs to be changed as well. I think it would work better if added to the jobtriggers module and use an entry point in the setup.py

I'm also wondering if it would be wise to at least file a ticket to add support for rolling log files. If we turned csv logging on in production and left it alone, that csv file would get huge before too long. It might be worth leaving the csv logging on for auditing purposes (having an easy way to see what was triggered and when).

Overall, it's a good start, though.

cli.py
24

why have an argument if this required and is the sole arg to the cli instead of just doing cli <filename>?

jobtriggers/koji_msg.py
44–51

I'd like to see this only log to csv when enabled (disabled by default) instead of always writing to the csv file specified in config. At the very least, it needs to not log to a file during unit tests

jobtriggers/utils.py
27

I'd like to see some error handling here if the file doesn't open properly. From what I can tell, fedmsg-hub doesn't die if there are file problems but it does introduce tracebacks into the logs.

testing/functest_cli.py
13

why use this instead of the tempfile fixture?

I'm also wondering if it would be wise to at least file a ticket to add support for rolling log files. If we turned csv logging on in production and left it alone, that csv file would get huge before too long.

Yeah, as stated in the description, I wanted to check if the approach is ok before trying logrotate. Agreed.

mkrizek updated this revision to Diff 301.May 26 2014, 11:42 AM

Address issues mentioned in the review

mkrizek updated this revision to Diff 306.May 27 2014, 12:52 PM
  • Add logrotate
tflink accepted this revision.May 27 2014, 2:30 PM

Other than the version bump, looks good to me. Please bump to 0.1.1 (setup.py and spec) when you push to develop

taskotron-trigger.spec
3

This should probably be a version bump since the code has changed, not just a release bump.

This revision is now accepted and ready to land.May 27 2014, 2:30 PM
mkrizek closed this revision.May 27 2014, 2:43 PM
mkrizek updated this revision to Diff 308.

Closed by commit rTRGRe156a79d9c3a (authored by @mkrizek).