Bug 1023041 - journal.send fails in mock
journal.send fails in mock
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-10-24 09:41 EDT by Richard Marko
Modified: 2016-01-31 21:23 EST (History)
9 users (show)

See Also:
Fixed In Version: systemd-208-14.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-02-24 07:34:58 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Richard Marko 2013-10-24 09:41:02 EDT
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):

How reproducible:

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
>>> 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 10:38:16 EDT
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 11:16:46 EST
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 11:19:32 EST
It does, it raises IOError exception with code set to ENOENT.
Comment 4 Richard Marko 2013-11-04 11:24:51 EST
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 12:03:48 EST
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 12:13:13 EST
Changed to ignore error in http://cgit.freedesktop.org/systemd/systemd/commit/?id=6c045c0.
Comment 7 Fedora Update System 2014-01-14 20:27:13 EST
systemd-208-11.fc20 has been submitted as an update for Fedora 20.
Comment 8 Fedora Update System 2014-01-16 02:03:36 EST
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:
then log in and leave karma (feedback).
Comment 9 Fedora Update System 2014-02-17 02:39:43 EST
systemd-208-13.fc20 has been submitted as an update for Fedora 20.
Comment 10 Fedora Update System 2014-02-17 10:08:11 EST
systemd-208-14.fc20 has been submitted as an update for Fedora 20.
Comment 11 Fedora Update System 2014-02-24 07:34:58 EST
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.

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