Commit Graph

48 Commits

Author SHA1 Message Date
Tobias Brunner 0ce2e00d94 vici: Don't use pytest-pycodestyle with Python 3.5
This causes problems due to a deprecation error during the Ubuntu Xenial
build on Travis.
2020-08-17 15:22:34 +02:00
Tobias Brunner f78dfb7e28 vici: Options are optional in get_pools() of Python bindings
Fixes #3319.
2020-02-03 10:52:31 +01:00
Tobias Brunner c584a6b2dc vici: Remove unused import in Python bindings 2020-01-28 15:29:40 +01:00
Tobias Brunner df4274171e vici: Remove unnecessary `pass` statement 2020-01-28 15:29:40 +01:00
Tobias Brunner ecf161e517 vici: Move Python test dir and include it in sdist
This is the recommended location and import config as it allows running the
tests against installed versions of the package.  And while the test file
itself is automatically included in the source distribution this way, the
__init__.py file is not, so we still have to update MANIFEST.in.
2020-01-14 16:53:19 +01:00
Tobias Brunner b723431540 vici: Run Python tests via tox if available
Since we use the serial test harness we can't use AM_TESTS_ENVIRONMENT.
The script is necessary for out-of-tree builds.
2020-01-14 15:26:52 +01:00
Tobias Brunner 574621d80a vici: Fix several PEP8 issues 2020-01-14 15:26:32 +01:00
Tobias Brunner d5153c5897 vici: Add tox.ini to run tests with tox
Some of the interpreters might not be available on the host system, use
--skip-missing-interpreters to not fail in that case.
2020-01-14 15:26:29 +01:00
Tobias Brunner c170bb593b vici: List newer Python versions in setup.py 2020-01-14 10:48:53 +01:00
Tobias Brunner 1352413272 vici: Update Python egg if strongSwan version changed
Mainly useful when using the build-strongswan script of the testing
environment.
2019-11-28 16:52:30 +01:00
Tobias Brunner c7a0b39bd6 vici: Add Python command wrappers to tarball
Fixes: e0f7da8644 ("vici: Extract command wrappers in Python bindings")
2019-05-06 15:51:05 +02:00
Tobias Brunner c5113c8105 vici: Add missing command wrappers for Python bindings
Also change some for which the return value became relevant.
2019-04-26 09:35:10 +02:00
Tobias Brunner e0f7da8644 vici: Extract command wrappers in Python bindings
This simplifies the interface and allows calling not yet wrapped
commands more easily.
2019-04-26 09:18:54 +02:00
odi79 0d66b01a81 vici: Fix type error exception in Python bindings
Line 66 yields "TypeError: can't concat bytes to str" using Python 3.4.
"requestdata" was introduced in 22f08609f1 but is not actually used.
Since the original "request" is not used anywhere else this can be changed
to be similar to the other UTF-8 encoding changes in that commit.

Fixes: 22f08609f1 ("vici: Explicitly set the Python encoding type").
Closes strongswan/strongswan#66.
2017-04-19 10:00:21 +02:00
Tobias Brunner d20bf50e04 vici: Update get_pools() in Python and Ruby bindings 2017-02-16 19:21:12 +01:00
Martin Willi 22f08609f1 vici: Explicitly set the Python encoding type
When using vici over RPyC and its (awesome) splitbrain, encoding and decoding
strings fails in vici, most likely because of the Monkey-Patch magic splitbrain
uses.

When specifying the implicit UTF-8 as encoding scheme explicitly, Python uses
the correct method to encode/decode the string, making vici useable in
splitbrain contexts.
2017-02-13 15:04:44 +01:00
Weilu Jia 351179d4dc vici: Check for closed connection in Python bindings
The Python VICI library does not check if the socket is closed.
If the daemon closes the connection, _recvall() spins forever.

Closes strongswan/strongswan#56.
2016-12-14 11:35:31 +01:00
Tobias Brunner d344474b3d vici: Fix indention of flush_certs() method in Python bindings 2016-09-20 15:33:18 +02:00
Andreas Steffen 2c7cfe7630 vici: flush-certs command flushes certificate cache
When fresh CRLs are released with a high update frequency (e.g.
every 24 hours) or OCSP is used then the certificate cache gets
quickly filled with stale CRLs or OCSP responses. The new VICI
flush-certs command allows to flush e.g. cached CRLs or OCSP
responses only. Without the type argument all kind of certificates
(e.g. also received end entity and intermediate CA certificates)
are purged.
2016-09-13 17:02:59 +02:00
Tobias Brunner 09328c5210 vici: Put source distribution in the dist dir in the build directory
This fixes the out-of-tree build.
2016-05-11 14:33:08 +02:00
Tobias Brunner 81b9de0126 vici: Add target to build a source package and universal wheel of the Python package 2016-05-11 11:36:51 +02:00
Tobias Brunner fa844a798b vici: Add README.rst to be used as description on PyPI 2016-05-11 11:16:43 +02:00
Tobias Brunner 5d5ecd8e72 vici: Replace dr with dev in version numbers for the Python egg
The versioning scheme used by Python (PEP 440) supports the rcN suffix
but development releases have to be named devN, not drN, which are
not supported and considered legacy versions.
2016-05-10 12:16:13 +02:00
Tobias Brunner 1ff7ff5ac8 vici: Update setup.py 2016-05-10 11:42:29 +02:00
Tobias Brunner 756cd28fb8 vici: Ensure we read exactly the specified amount of bytes from the socket in Python
recv() will return less bytes than specified (as that's the buffer size)
if not as many are ready to be read from the socket.
2016-05-10 11:42:29 +02:00
Tobias Brunner 43b46b26ea vici: Add redirect command
This allows redirecting IKE_SAs by multiple different selectors, if none
are given all SAs are redirected.
2016-03-04 16:02:59 +01:00
Tobias Brunner b3d91cc64e vici: Add listen methods to receive arbitrary events in Python library 2015-08-17 11:12:18 +02:00
Tobias Brunner cf4cefee42 vici: Move event (un-)registration to a helper method in Python library
Also make sure events are unregistered in case of exceptions in
streamed_request().
2015-08-17 11:12:17 +02:00
Tobias Brunner f16f792e17 vici: Make installation of Ruby Gem and Python Egg optional
Installing them might not work well when building distro packages (e.g.
with DESTDIR installs).  It might be easier to install them later with a
script in the distro package.

When building from source on the local system it could still be useful to
install the packages directly, which can be enabled with separate configure
options.

The main problem with DESTDIR installations of the Python Egg is that
easy_install creates or modifies a file called easy-install.pth in the
installation directory.  So it's not actually possible to simply copy
the results in DESTDIR over to the actual system as that file would have
to be merged with any existing one.

Fixes #914.
2015-05-21 17:22:01 +02:00
Tobias Brunner 5a817407bc vici: Support out-of-tree build of Python Egg
We also don't require setup.py to exist during cleanup, as e.g. with
make distcheck the source directory is not writable when the build directory
is cleaned, so setup.py can't be created (to just get removed again anyway
if VICI and the Python Eggs haven't been enabled previously).
2015-05-21 17:19:09 +02:00
Björn Schuberg 2e74aa0a91 vici: Add support for python 3 2015-03-18 13:59:15 +01:00
Martin Willi c7e3c5943f vici: Execute python tests during "check" if py.test is available 2015-03-18 13:59:15 +01:00
Björn Schuberg c193b5947a vici: Add test of Packet layer in python library 2015-03-18 13:59:15 +01:00
Björn Schuberg 9b97029a5f vici: Add test of Message (de)serialization in python library 2015-03-18 13:59:15 +01:00
Martin Willi b5d17e55d7 vici: Evaluate Python streamed command results, and raise CommandException 2015-03-18 13:59:14 +01:00
Martin Willi 90c5b48c96 vici: Catch Python GeneratorExit to properly cancel streamed event iteration 2015-03-18 13:59:14 +01:00
Martin Willi a47e431ba9 vici: Return a Python generator instead of a list for streamed responses
In addition that it may reduce memory usage and improve performance for large
responses, it returns immediate results. This is important for longer lasting
commands, such as initiate/terminate, where immediate log feedback is preferable
when interactively calling such commands.
2015-03-18 13:59:14 +01:00
Martin Willi 90e16837ba vici: Raise a Python CommandException instead of returning a CommandResult 2015-03-18 13:59:14 +01:00
Martin Willi 305023a27d vici: Use OrderedDict to handle vici responses in Python library
The default Python dictionaries are unordered, but order is important for some
vici trees (for example the order of authentication rounds).
2015-03-18 13:59:14 +01:00
Martin Willi 61fb10c8cf vici: Support non-Unix sockets for vici connections using Python 2015-03-18 13:59:14 +01:00
Martin Willi 358793389a vici: Add python egg setuptools building and installation using easy_install
An uninstall target is currently not supported, as there is no trivial way with
either plain setuptools or with easy_install. pip would probably be the best
choice, but we currently don't depend on it.
2015-03-18 13:59:14 +01:00
Martin Willi 1e2ec9f96a vici: Generate a version specific setup.py for setuptools installation 2015-03-18 13:59:14 +01:00
Martin Willi 2c8c52c4e2 vici: Include python package in distribution 2015-03-18 13:59:14 +01:00
Björn Schuberg 163e15a571 vici: Add python package MIT license 2015-03-18 13:59:13 +01:00
Björn Schuberg b269c1a89a vici: Expose Session as a top-level symbol in python package 2015-03-18 13:59:13 +01:00
Björn Schuberg 6a31a0f60c vici: Introduce main API Session class in python package 2015-03-18 13:59:13 +01:00
Björn Schuberg 8c089cddef vici: Add a python vici command execution handler 2015-03-18 13:59:13 +01:00
Björn Schuberg b26e142863 vici: Add vici python protocol handler 2015-03-18 13:59:13 +01:00