Bug 1023041

Summary: journal.send fails in mock
Product: [Fedora] Fedora Reporter: Richard Marko <rmarko>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 20CC: jberan, johannbg, lnykryn, msekleta, plautrba, rmarko, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-208-14.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-24 12:34:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard Marko 2013-10-24 13:41:02 UTC
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):
systemd-208-2.fc20.x86_64

How reproducible:
Always

Steps to Reproduce:
1. mock -r fedora-20-x86_64 --shell
2. python -c "from systemd import journal; journal.send('this fails')"

Result:
<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
>>> syslog.syslog('tt')
>>> from systemd import journal
>>> journal.send('tt')
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
    return sendv(*args)
IOError: [Errno 2] No such file or directory

Comment 1 Zbigniew Jędrzejewski-Szmek 2013-10-24 14:38:16 UTC
Right, it fails, because /run/systemd/journal/socket is not available, because journald is not running. What do you suggest instead?

Comment 2 Richard Marko 2013-11-04 16:16:46 UTC
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.

Comment 3 Zbigniew Jędrzejewski-Szmek 2013-11-04 16:19:32 UTC
It does, it raises IOError exception with code set to ENOENT.

Comment 4 Richard Marko 2013-11-04 16:24:51 UTC
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.

Comment 5 Zbigniew Jędrzejewski-Szmek 2013-11-04 17:03:48 UTC
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.

Comment 6 Zbigniew Jędrzejewski-Szmek 2013-12-03 17:13:13 UTC
Changed to ignore error in http://cgit.freedesktop.org/systemd/systemd/commit/?id=6c045c0.

Comment 7 Fedora Update System 2014-01-15 01:27:13 UTC
systemd-208-11.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-11.fc20

Comment 8 Fedora Update System 2014-01-16 07:03:36 UTC
Package systemd-208-11.fc20:
* 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:
https://admin.fedoraproject.org/updates/FEDORA-2014-0902/systemd-208-11.fc20
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2014-02-17 07:39:43 UTC
systemd-208-13.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-13.fc20

Comment 10 Fedora Update System 2014-02-17 15:08:11 UTC
systemd-208-14.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-14.fc20

Comment 11 Fedora Update System 2014-02-24 12:34:58 UTC
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.