History log of /lxc/src/python-lxc/examples/api_test.py
Revision Date Author Comments Expand
03bd7f728ed8605210c93fec739c612972484e8c 05-Jan-2017 Po-Hsu Lin <po-hsu.lin@canonical.com>

python3-lxc: fix api_test.py on s390x The api_test.py script uses Trusty release by default, which does not have s390x image. Switch to Xenial to solve this. Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

51ee3c5891d7e95247adb6b605a2e3ab591dc449 26-Oct-2016 Evgeni Golov <evgeni@debian.org>

mark the python examples as having utf-8 encoding this allows running them also under Python2, which otherwise would choke on Stéphane's name and error out with SyntaxError: Non-ASCII character '\xc3' in file … Signed-off-by: Evgeni Golov <evgeni@debian.org>

e2f91e3434ddf2d4cb85d2385057a492eb462166 10-Nov-2015 Fox Wilson <2016fwilson@babbage.csl.tjhsst.edu>

Use /usr/bin/env python3 instead of /usr/bin/python3 project-wide This fixes invocations of certain commands when python3 is installed in a nonstandard path (/usr/local/bin, for example). Signed-off-by: Fox Wilson <2016fwilson@tjhsst.edu>

4e31246a25d29db0c554ae2f6b34fc19b8fcdefd 09-Jun-2014 Stéphane Graber <stgraber@ubuntu.com>

python3: Fix crashes in snapshot() This makes sure all PyObject structs are always initialized to NULL, this will fix issues such as (issue #239). Also add a snapshot/list/restore testcase to the python3 api test code. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

0b648faeca47475682679caa750c224e6a5d7cff 07-May-2014 Dwight Engen <dwight.engen@oracle.com>

python3: remove assert since hwaddr isn't set by the download template Signed-off-by: Dwight Engen <dwight.engen@oracle.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>

cd063f4524ce16ad3de1820780f1b5763de43f5d 13-Feb-2014 Stéphane Graber <stgraber@ubuntu.com>

python3: Update apitest This update will make it work unprivileged as well as testing a few of the new functions. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

c756a6e91b6d6da2ff8a21b5a4ece26b05b99283 13-Feb-2014 Stéphane Graber <stgraber@ubuntu.com>

python3: Drop API warning and fix pep8/pyflakes3 Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

0464b881e68ef5f50bd7bb9633b70e2e89be039b 31-Jan-2014 Stéphane Graber <stgraber@ubuntu.com>

shutdown: Rework API and lxc-stop With this change, shutdown() will no longer call stop() after the timeout, instead it'll just return false and it's up to the caller to then call stop() if appropriate. This also updates the bindings, tests and other scripts. lxc-stop is then updated to do proper option checking and use shutdown, stop or reboot as appropriate. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

e6c6d62287d4259cff223313eef3b7c5b03e2a1b 24-Jan-2014 Stéphane Graber <stgraber@ubuntu.com>

tests: Fix python3 API test Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>

2edd7a881d7d6b94c13d18c28ce6a6a15966ed31 03-Dec-2013 Stéphane Graber <stgraber@ubuntu.com>

python3: Fix PEP8 and avoid crash when listing Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>

f10e04e36170dbd0faae3a667d53f0af1ef6a13a 16-Oct-2013 Stéphane Graber <stgraber@ubuntu.com>

Make 'make dist' match git content This fixes a few obvious issues when comparing the make dist output with the git tree. - Make all templates non-executable in git - Remove unused files: - src/lxc/list.c (empty, only includes the list.h header) - src/lxc/lxc-destroy.in (replace by lxc_destroy.c) - Add missing files to dist tarball: - src/python-lxc/examples/pyconsole.py - src/python-lxc/examples/pyconsole-vte.py - Mark all the python API tests executable - Mark lxc-test-ubuntu executable Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>

799f29ab699f08e67231b012f20a25e23a6c391d 18-Sep-2013 S.Çağlar Onur < <caglar@10ur.org>

Add get_interfaces to the API get_ips accepts an interface name as a parameter but there was no way to get the interfaces names from the container. This patch introduces a new get_interfaces call to the API so that users can obtain the name of the interfaces. Support for python bindings also introduced as a part of this version. Signed-off-by: S.Çağlar Onur <caglar@10ur.org> Acked-by: Stéphane Graber <stgraber@ubuntu.com>

250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77 03-Sep-2013 Stéphane Graber <stgraber@ubuntu.com>

licensing: Add missing headers and FSF address Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>

/lxc/autogen.sh /lxc/doc/common_options.sgml.in /lxc/doc/legacy/lxc-ls.sgml.in /lxc/doc/lxc-attach.sgml.in /lxc/doc/lxc-cgroup.sgml.in /lxc/doc/lxc-checkconfig.sgml.in /lxc/doc/lxc-checkpoint.sgml.in /lxc/doc/lxc-clone.sgml.in /lxc/doc/lxc-console.sgml.in /lxc/doc/lxc-create.sgml.in /lxc/doc/lxc-destroy.sgml.in /lxc/doc/lxc-device.sgml.in /lxc/doc/lxc-execute.sgml.in /lxc/doc/lxc-freeze.sgml.in /lxc/doc/lxc-info.sgml.in /lxc/doc/lxc-kill.sgml.in /lxc/doc/lxc-ls.sgml.in /lxc/doc/lxc-monitor.sgml.in /lxc/doc/lxc-netstat.sgml.in /lxc/doc/lxc-ps.sgml.in /lxc/doc/lxc-restart.sgml.in /lxc/doc/lxc-start-ephemeral.sgml.in /lxc/doc/lxc-start.sgml.in /lxc/doc/lxc-stop.sgml.in /lxc/doc/lxc-top.sgml.in /lxc/doc/lxc-unfreeze.sgml.in /lxc/doc/lxc-unshare.sgml.in /lxc/doc/lxc-version.sgml.in /lxc/doc/lxc-wait.sgml.in /lxc/doc/lxc.conf.sgml.in /lxc/doc/lxc.sgml.in /lxc/doc/see_also.sgml.in /lxc/hooks/mountcgroups /lxc/hooks/mountecryptfsroot /lxc/lxc.spec.in /lxc/runapitests.sh /lxc/src/include/getline.c /lxc/src/include/getline.h /lxc/src/include/lxcmntent.c /lxc/src/include/lxcmntent.h /lxc/src/include/openpty.c /lxc/src/include/openpty.h /lxc/src/lxc/af_unix.c /lxc/src/lxc/af_unix.h /lxc/src/lxc/apparmor.c /lxc/src/lxc/apparmor.h /lxc/src/lxc/arguments.c /lxc/src/lxc/arguments.h /lxc/src/lxc/attach.c /lxc/src/lxc/attach.h /lxc/src/lxc/attach_options.h /lxc/src/lxc/bdev.c /lxc/src/lxc/bdev.h /lxc/src/lxc/caps.c /lxc/src/lxc/caps.h /lxc/src/lxc/cgroup.c /lxc/src/lxc/cgroup.h /lxc/src/lxc/checkpoint.c /lxc/src/lxc/commands.c /lxc/src/lxc/commands.h /lxc/src/lxc/conf.c /lxc/src/lxc/conf.h /lxc/src/lxc/confile.c /lxc/src/lxc/confile.h /lxc/src/lxc/console.c /lxc/src/lxc/console.h /lxc/src/lxc/error.c /lxc/src/lxc/error.h /lxc/src/lxc/execute.c /lxc/src/lxc/freezer.c /lxc/src/lxc/genl.c /lxc/src/lxc/genl.h /lxc/src/lxc/legacy/lxc-ls.in /lxc/src/lxc/list.c /lxc/src/lxc/list.h /lxc/src/lxc/log.c /lxc/src/lxc/log.h /lxc/src/lxc/lxc-destroy.in /lxc/src/lxc/lxc-device /lxc/src/lxc/lxc-ls /lxc/src/lxc/lxc-netstat.in /lxc/src/lxc/lxc-ps.in /lxc/src/lxc/lxc-start-ephemeral.in /lxc/src/lxc/lxc.functions.in /lxc/src/lxc/lxc.h /lxc/src/lxc/lxc_attach.c /lxc/src/lxc/lxc_cgroup.c /lxc/src/lxc/lxc_checkpoint.c /lxc/src/lxc/lxc_config.c /lxc/src/lxc/lxc_console.c /lxc/src/lxc/lxc_execute.c /lxc/src/lxc/lxc_freeze.c /lxc/src/lxc/lxc_info.c /lxc/src/lxc/lxc_init.c /lxc/src/lxc/lxc_kill.c /lxc/src/lxc/lxc_monitor.c /lxc/src/lxc/lxc_monitord.c /lxc/src/lxc/lxc_restart.c /lxc/src/lxc/lxc_start.c /lxc/src/lxc/lxc_stop.c /lxc/src/lxc/lxc_unfreeze.c /lxc/src/lxc/lxc_unshare.c /lxc/src/lxc/lxc_usernsexec.c /lxc/src/lxc/lxc_wait.c /lxc/src/lxc/lxccontainer.h /lxc/src/lxc/lxcseccomp.h /lxc/src/lxc/lxcutmp.c /lxc/src/lxc/lxcutmp.h /lxc/src/lxc/mainloop.c /lxc/src/lxc/mainloop.h /lxc/src/lxc/monitor.c /lxc/src/lxc/monitor.h /lxc/src/lxc/namespace.c /lxc/src/lxc/namespace.h /lxc/src/lxc/network.c /lxc/src/lxc/network.h /lxc/src/lxc/nl.c /lxc/src/lxc/nl.h /lxc/src/lxc/parse.c /lxc/src/lxc/parse.h /lxc/src/lxc/restart.c /lxc/src/lxc/rtnl.c /lxc/src/lxc/rtnl.h /lxc/src/lxc/seccomp.c /lxc/src/lxc/start.c /lxc/src/lxc/start.h /lxc/src/lxc/state.c /lxc/src/lxc/state.h /lxc/src/lxc/sync.c /lxc/src/lxc/sync.h /lxc/src/lxc/utils.c /lxc/src/lxc/utils.h /lxc/src/lxc/version.c /lxc/src/lxc/version.h api_test.py pyconsole-vte.py pyconsole.py /lxc/src/python-lxc/lxc.c /lxc/src/python-lxc/lxc/__init__.py /lxc/src/python-lxc/setup.py /lxc/src/tests/lxc-test-usernic /lxc/templates/lxc-altlinux.in /lxc/templates/lxc-archlinux.in /lxc/templates/lxc-busybox.in /lxc/templates/lxc-debian.in /lxc/templates/lxc-fedora.in /lxc/templates/lxc-opensuse.in /lxc/templates/lxc-oracle.in /lxc/templates/lxc-sshd.in
ca9548ad02238600899a1f86ded308279964e018 03-Sep-2013 Stéphane Graber <stgraber@ubuntu.com>

python: Fix api_test to use the new attach() API Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

9c83a661397456e1455d739bcadfa38f05ce2fe6 21-May-2013 Stéphane Graber <stgraber@ubuntu.com>

lxcapi: Add new get_ips() call This adds a new get_ips call which takes a family (inet, inet6 or NULL), a network interface (or NULL for all) and a scope (0 for global) and returns a char** of all the IPs in the container. This also adds a matching python3 binding (function result is a tuple) and deprecates the previous pure-python get_ips() implementation. WARNING: The python get_ips() call is quite different from the previous implementation. The timeout argument has been removed, the family names are slightly different (inet/inet6 vs ipv4/ipv6) and an extra scope parameter has been added. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

1cb4260d10df377deb64f4d2a5fc188890b01e66 01-Mar-2013 Stéphane Graber <stgraber@ubuntu.com>

python api_test: Drop use of @LXCPATH@ The python api test script was using @LXCPATH@ for one of its checks. Now that the lxcpath is exposed by the lxc python module directly, this can be dropped and api_test.py can now become a simple python file without needing pre-processing by autoconf. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

bde1853954e7e0a33fec872391c757933c063ae9 26-Nov-2012 Stéphane Graber <stgraber@ubuntu.com>

python: PEP8 compatibility The new version of the pep8 command is detecting more indentation mistakes than it used to, this fixes them. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

5a339bbb87e06cb4687056e07985eeb6bafef002 12-Nov-2012 Stéphane Graber <stgraber@ubuntu.com>

api_test.py: Remove workarounds for API bugs The script used to contain a workaround for back when create() wouldn't properly flush the config and reload it. As these issues have now been fixed, these workarounds can be removed. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>

e0de36d791e82d9916cad4ac41562077cf9789c3 12-Nov-2012 Stéphane Graber <stgraber@ubuntu.com>

Add better example/test of the python3-lxc API Replaced python-lxc/test.py by a new api_test.py script that uses all the available function of the API to run a batch of basic tests. This example is useful both as a test of the API and as a guide on how to use the python API to manage containers. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>