mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-26 03:32:44 +00:00
python: Don't hardcode LXCPATH in python module
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
0d03360a77
commit
24fcdb395f
1
.gitignore
vendored
1
.gitignore
vendored
@ -66,7 +66,6 @@ src/lxc/lxc-wait
|
|||||||
src/lxc/legacy/lxc-ls
|
src/lxc/legacy/lxc-ls
|
||||||
|
|
||||||
src/python-lxc/build/
|
src/python-lxc/build/
|
||||||
src/python-lxc/lxc/__init__.py
|
|
||||||
src/python-lxc/lxc/__pycache__/
|
src/python-lxc/lxc/__pycache__/
|
||||||
|
|
||||||
src/tests/lxc-test-containertests
|
src/tests/lxc-test-containertests
|
||||||
|
@ -383,7 +383,6 @@ AC_CONFIG_FILES([
|
|||||||
src/lxc/lxc.functions
|
src/lxc/lxc.functions
|
||||||
|
|
||||||
src/python-lxc/Makefile
|
src/python-lxc/Makefile
|
||||||
src/python-lxc/lxc/__init__.py
|
|
||||||
|
|
||||||
src/lua-lxc/Makefile
|
src/lua-lxc/Makefile
|
||||||
|
|
||||||
|
@ -95,6 +95,12 @@ Container_init(Container *self, PyObject *args, PyObject *kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
get_default_config_path(Container *self, PyObject *args, PyObject *kwds)
|
||||||
|
{
|
||||||
|
return PyUnicode_FromString(lxc_get_default_config_path());
|
||||||
|
}
|
||||||
|
|
||||||
// Container properties
|
// Container properties
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Container_config_file_name(Container *self, PyObject *args, PyObject *kwds)
|
Container_config_file_name(Container *self, PyObject *args, PyObject *kwds)
|
||||||
@ -628,12 +634,18 @@ PyVarObject_HEAD_INIT(NULL, 0)
|
|||||||
Container_new, /* tp_new */
|
Container_new, /* tp_new */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static PyMethodDef LXC_methods[] = {
|
||||||
|
{"get_default_config_path", (PyCFunction)get_default_config_path, METH_NOARGS,
|
||||||
|
"Returns the current LXC config path"},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
static PyModuleDef _lxcmodule = {
|
static PyModuleDef _lxcmodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"_lxc",
|
"_lxc",
|
||||||
"Binding for liblxc in python",
|
"Binding for liblxc in python",
|
||||||
-1,
|
-1,
|
||||||
NULL, NULL, NULL, NULL, NULL
|
LXC_methods
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
|
@ -26,14 +26,13 @@ import glob
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import stat
|
import stat
|
||||||
import tempfile
|
|
||||||
import time
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.warn("The python-lxc API isn't yet stable "
|
warnings.warn("The python-lxc API isn't yet stable "
|
||||||
"and may change at any point in the future.", Warning, 2)
|
"and may change at any point in the future.", Warning, 2)
|
||||||
|
|
||||||
default_config_path = "@LXCPATH@"
|
default_config_path = _lxc.get_default_config_path()
|
||||||
|
|
||||||
|
|
||||||
class ContainerNetwork():
|
class ContainerNetwork():
|
Loading…
Reference in New Issue
Block a user