summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Prepare v234v234Zbigniew Jędrzejewski-Szmek2017-03-252-1/+18
|
* Update to constants from systemd-233Zbigniew Jędrzejewski-Szmek2017-03-255-40/+54
| | | | | | | In systemd-233 the format of the constants file changed to use SD_ID128_MAKE_STR macro and long lines are broken with '\'. Doing this in sed is too anyoing — add a simple python script to do the processing.
* journal: fix repr of JournalHandler to match python3.6Zbigniew Jędrzejewski-Szmek2017-03-251-1/+1
| | | | | | We get <systemd.journal.JournalHandler object at ...> in older versions, and <JournalHandler (NOTSET)> in since Python 3.6. https://github.com/python/cpython/commit/c0752011472790e34d171b89f4b862cc3fd8ad08
* journal: do not convert extra args to string in JournalHandlerZbigniew Jędrzejewski-Szmek2017-03-192-6/+6
| | | | | | send() already does conversions in a type-specific way, and doing it in journal handler would defeat those conversions. In particular, UUIDs would be converted to early and have dashes.
* test_journal: add tests for MESSAGE_ID passingZbigniew Jędrzejewski-Szmek2017-03-191-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MESSAGE_ID passing was broken before previous commit: TypeError: send() got multiple values for keyword argument 'MESSAGE_ID' With the previous commit it's broken differently: ______________________________ test_journalhandler_message_id_on_handler _______________________________ def test_journalhandler_message_id_on_handler(): record = logging.LogRecord('test-logger', logging.INFO, 'testpath', 1, 'test', None, None) sender = MockSender() handler = journal.JournalHandler(logging.INFO, sender_function=sender.send, MESSAGE_ID=TEST_MID) handler.emit(record) assert len(sender.buf) == 1 > assert 'MESSAGE_ID=' + TEST_MID.hex in sender.buf[0] E assert ('MESSAGE_ID=' + '8441372f8dca4ca98694a6091fd8519f') in ['MESSAGE=test', 'MESSAGE_ID=8441372f-8dca-4ca9-8694-a6091fd8519f', 'CODE_FILE=testpath', 'CODE_LINE=1', 'name=test-logger', 'exc_info=None', ...] E + where '8441372f8dca4ca98694a6091fd8519f' = UUID('8441372f-8dca-4ca9-8694-a6091fd8519f').hex systemd/test/test_journal.py:116: AssertionError ______________________________ test_journalhandler_message_id_on_message _______________________________ def test_journalhandler_message_id_on_message(): record = logging.LogRecord('test-logger', logging.INFO, 'testpath', 1, 'test', None, None) record.__dict__['MESSAGE_ID'] = TEST_MID2 sender = MockSender() handler = journal.JournalHandler(logging.INFO, sender_function=sender.send, MESSAGE_ID=TEST_MID) handler.emit(record) assert len(sender.buf) == 1 > assert 'MESSAGE_ID=' + TEST_MID2.hex in sender.buf[0] E assert ('MESSAGE_ID=' + '8441370000000000000000001fd85000') in ['MESSAGE=test', 'MESSAGE_ID=84413700-0000-0000-0000-00001fd85000', 'CODE_FILE=testpath', 'CODE_LINE=1', 'name=test-logger', 'exc_info=None', ...] E + where '8441370000000000000000001fd85000' = UUID('84413700-0000-0000-0000-00001fd85000').hex systemd/test/test_journal.py:135: AssertionError ============================ 2 failed, 53 passed, 6 skipped in 0.16 seconds ============================
* Remove mid from JournalHandlerWesley Bowman2017-03-191-2/+0
| | | | | | Removed mid variable from JournalHandler since the MESSAGE_ID is already in the extras variable. MESSAGE_ID was being set to None, but this won't appear in the logs.
* journal: rename SENDER_FUNCTION to sender_functionZbigniew Jędrzejewski-Szmek2017-03-192-3/+6
| | | | | | | Let's not try to make it look like a journal field. It should be a normal parameter. Followup for dce0a855c3281e7051b1cbe0f73386d1c90ef320.
* daemon: properly skip sd_is_socket_sockaddr calls if not availableZbigniew Jędrzejewski-Szmek2017-03-192-19/+38
| | | | | As with other functions, the wrapper is always present, but returns OSError: [Errno 38] Function not implemented.
* Makefile: add convenience "shell" target to start python shellZbigniew Jędrzejewski-Szmek2017-03-191-1/+5
|
* Makefile: add "doc" target for convenienceZbigniew Jędrzejewski-Szmek2017-03-191-1/+3
|
* Makefile: remove unneeded -I/usr/include from flagsZbigniew Jędrzejewski-Szmek2017-03-191-1/+2
| | | | | | | gcc warns about an include directive that shadows the system include directory at high verbosity levels. Let's filter it out (pkgconfig implements that) to reduce noise and also to make the command line shorter.
* Fix styling to match PEP8 in most places (#45)Wesley Bowman2017-03-142-7/+20
| | | | Backwards compatibility for mapPriority is retained.
* Merge pull request #34 from keszybz/test-skippingZbigniew Jędrzejewski-Szmek2017-03-137-25/+77
|\ | | | | Improve test skipping on old systems.
| * journal: improve docstring formatting a bitZbigniew Jędrzejewski-Szmek2017-03-121-4/+4
| |
| * Adjust import order, spacing, operators as recommended by pylintZbigniew Jędrzejewski-Szmek2017-03-124-19/+21
| |
| * tests: move login tests from doctest to separate fileZbigniew Jędrzejewski-Szmek2017-03-123-4/+54
|/ | | | | | | | | This way we can skip ENOENT (which happens in containers). While at it, let's extend the tests a bit, so that we at least call all functions and check the type of the return value. Also, drop '.nspawn' from the machine name, nspawn doesn't use that suffix any more.
* Prevent non-str values from being concatenated with + (#40)Jimmy Cao2017-03-121-3/+3
| | | | Make _make_line concatenate only strings directly.
* Merge pull request #31 from keszybz/is_socket_sockaddrZbigniew Jędrzejewski-Szmek2017-03-119-28/+366
|\ | | | | daemon: add basic support for sd_is_socket_sockaddr
| * Fix handling of addresses without port and add testsZbigniew Jędrzejewski-Szmek2016-12-152-47/+62
| |
| * daemon: add wrapper for sd_is_socket_sockaddr and testsZbigniew Jędrzejewski-Szmek2016-12-152-5/+54
| | | | | | | | Specifying the address without does not work.
| * _daemon: allow specifying flowinfoZbigniew Jędrzejewski-Szmek2016-12-151-4/+15
| | | | | | | | Not particularly useful, but let's have it for completeness.
| * util: add compatibility for old glibcZbigniew Jędrzejewski-Szmek2016-12-151-0/+4
| | | | | | | | Oh, Ubuntu!
| * daemon: add basic support for sd_is_socket_sockaddrZbigniew Jędrzejewski-Szmek2016-12-154-6/+254
| | | | | | | | Later on a proper wrapper in daemon.py should be added.
| * _daemon,_reader: return ENOSYS instead of NotImplementedZbigniew Jędrzejewski-Szmek2016-12-152-5/+5
| | | | | | | | | | | | | | | | | | In _reader we were raising OSError(errno=ENOSYS), but in _dameon we were raising NotImplementedError. Let's always use ENOSYS. Also, make the messages in _reader more specific. Fixes #33.
| * tests: skip journal.stream tests on ENOENT errorZbigniew Jędrzejewski-Szmek2016-12-152-12/+23
| | | | | | | | | | | | | | | | When running in a chroot, doctests that called journal.stream would fail with ENOENT. Move the tests to test_journal, where we can skip tests properly (without uglyfying the documentation). Fixes #32.
* | replace dict.iteritems() with dict.items() to support py3 (#39)Jeongsoo, Park2017-03-112-12/+50
| | | | | | py3 doesn't have dict.iteritems() anymore.
* | test_daemon: xfail test_notify_with_socket if bind() fails (#42)Mike Gilbert2017-03-111-1/+4
| | | | | | | | | | This bind() call may fail if TMPDIR is too long. Bug: https://bugs.gentoo.org/610368
* | Python 3.6 invalid escape sequence deprecation fixes (#43)Ville Skyttä2017-03-111-2/+2
| | | | | | https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
* | Added section for installation on openSUSE & SLE (#35)Johannes Weberhofer2016-12-161-0/+4
|/
* setup.py: allow LIBSYSTEMD_VERSION to be overriddenZbigniew Jędrzejewski-Szmek2016-12-141-3/+8
| | | | | | This is useful when testing against old or unreleases versions of the library: make PYTHON=python3 INCLUDE_DIR=/home/zbyszek/src/systemd-master/src LIBSYSTEMD_VERSION=233
* Makefile: use $(INCLUDE_DIR) also for compilationZbigniew Jędrzejewski-Szmek2016-12-131-0/+1
| | | | | | This way we can compile against unreleased systemd: make PYTHON=python3 INCLUDE_DIR=/home/zbyszek/src/systemd/src (cd build/lib.linux-x86_64-3.5; systemd-socket-activate -E LD_LIBRARY_PATH=/home/zbyszek/src/systemd-master/.libs -l2000 -l127.0.0.1:2001 python3)
* build-sys: add sign and upload targetsZbigniew Jędrzejewski-Szmek2016-12-132-2/+7
|
* Include all fields from record (#30)Oleksii Shevchuk2016-10-271-1/+16
| | | | This approach allows to use LoggerAdapter+extra or .info(.., extra={}) to transparently add extra fields to journal.
* Prepare v233v233Zbigniew Jędrzejewski-Szmek2016-10-172-1/+13
|
* id128: add SD_MESSAGE_TRUNCATED_CORE from upcoming systemd-232Zbigniew Jędrzejewski-Szmek2016-10-173-0/+3
|
* journal: allow stream() to be used without any argumentsZbigniew Jędrzejewski-Szmek2016-10-171-3/+12
| | | | | | | | | It's fairly easy to provide a reasonable default for the first argument. Let's do that. Also, the documentation was misleading, suggesting that the function itself can be passed as file parameter to print(). Use a different name for the temporary variable to clarify that.
* journal: bump default log level for stream() to INFOZbigniew Jędrzejewski-Szmek2016-10-171-1/+1
| | | | | By default debug messages are ignored, and INFO should be used for "normal" messages.
* Updating docs for missing dependency (#28)Robert James Hernandez2016-10-101-3/+3
| | | | | | I was trying to build python-systemd from source but ran into the same issue here: #17 I Figure the docs should be updated to reflect this dependency.
* setup.py: make build fail if undeclared symbols are usedZbigniew Jędrzejewski-Szmek2016-10-011-0/+5
| | | | | | This will detect cases where the autoconfig based on version is wrong. Debian bug #839224.
* build-sys: import "pytest" instead of "py.test"Zbigniew Jędrzejewski-Szmek2016-09-221-1/+1
| | | | | Fixes the following error in rawhide: /usr/bin/python3: loader for pytest cannot handle py.test
* _reader: use proper ifdef guard for sd_j_open_files_fdZbigniew Jędrzejewski-Szmek2016-09-221-3/+7
|
* tests: add workaround for pre-232 system returning EINVAL on some flagsZbigniew Jędrzejewski-Szmek2016-09-221-5/+15
|
* build-sys: add doc-sync targetZbigniew Jędrzejewski-Szmek2016-09-221-1/+5
|
* docs: fix sphinx format warningZbigniew Jędrzejewski-Szmek2016-09-221-3/+3
| | | | build/lib.linux-x86_64-3.5/systemd/journal.py:docstring of systemd.journal.stream:15: WARNING: Literal block expected; none found.
* tests: skip fdstore tests if not implementedZbigniew Jędrzejewski-Szmek2016-09-221-3/+15
| | | | Should fix #12.
* Prepare v232v232Zbigniew Jędrzejewski-Szmek2016-09-212-1/+21
|
* setup.py: change name to systemd-pythonZbigniew Jędrzejewski-Szmek2016-09-213-1/+4
| | | | This name is unused on pypi. Let's grab it.
* docs: autoregenerate id128.rstZbigniew Jędrzejewski-Szmek2016-09-212-2/+17
|
* Store id128-constants.h in the repositoryZbigniew Jędrzejewski-Szmek2016-09-218-24/+108
| | | | | | | | | | | | | | Instead of generating the list of message ids anew during every build, the file is generated manually and committed into the repository. Also, the list of defines is stored in id128-defines.h, also kept in the repository. Both files should only grow. This should make build easier. But it also fixes a problem with systemd, which occasionally drops message definitions. We will keep them forever, so it should be safe to rely on the presence of message definitions which systemd does not use anymore. Fixes #23.
* journal: convert seek_realtime argument to microsecondsZbigniew Jędrzejewski-Szmek2016-09-212-7/+32
| | | | | | | | | | | | | This somewhat breaks backwards compatibility, but not for the previously documented arguments: floats are now interpreted differently, but ints and datetime.datetime objects are interpreted the same as before. But the documentation clearly stated that only ints and datetime.datetime objects were allowed. This makes seek_realtime match seek_monotonic and other functions which take time and follows the principle of least surprise. Fixes #21.