Red Hat Bugzilla – Bug 1023041
journal.send fails in mock
Last modified: 2016-01-31 21:23:00 EST
Description of problem:
journal.send raises an exception when called in mock (in our case, one of the tests tries to use it and fails).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. mock -r fedora-20-x86_64 --shell
2. python -c "from systemd import journal; journal.send('this fails')"
<mock-chroot>[root@grampi tests]# python
Python 2.7.5 (default, Oct 8 2013, 12:17:55)
[GCC 4.8.1 20130814 (Red Hat 4.8.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import syslog
>>> from systemd import journal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/systemd/journal.py", line 406, in send
IOError: [Errno 2] No such file or directory
Right, it fails, because /run/systemd/journal/socket is not available, because journald is not running. What do you suggest instead?
Either raising an exception that would tell us what happened or failing silently the same way as syslog.syslog does. Non-zero return code can be used to indicate failure.
It does, it raises IOError exception with code set to ENOENT.
That's not helpful at all (it doesn't tell you where the problem is) and forces us to wrap logging calls to try/catch block which doesn't make much sense to me.
It fails hard, instead of ignoring the failure to send, because journald is always available. We might want to treat ENOENT here as a silent failure indeed.
Changed to ignore error in http://cgit.freedesktop.org/systemd/systemd/commit/?id=6c045c0.
systemd-208-11.fc20 has been submitted as an update for Fedora 20.
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-11.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
systemd-208-13.fc20 has been submitted as an update for Fedora 20.
systemd-208-14.fc20 has been submitted as an update for Fedora 20.
systemd-208-14.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.