Commit 2495cc91 by Stéphane Graber

python: Remove hardcoded LXCPATH

Switch the python scripts to using @LXCPATH@. According to grep, this was the last occurence of a /var/*/lxc path in the code. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent fe253caa
...@@ -271,6 +271,8 @@ AC_CONFIG_FILES([ ...@@ -271,6 +271,8 @@ AC_CONFIG_FILES([
src/lxc/legacy/lxc-ls src/lxc/legacy/lxc-ls
src/python-lxc/Makefile src/python-lxc/Makefile
src/python-lxc/lxc/__init__.py
src/python-lxc/examples/api_test.py
src/tests/Makefile src/tests/Makefile
......
...@@ -30,7 +30,7 @@ import uuid ...@@ -30,7 +30,7 @@ import uuid
import sys import sys
# Some constants # Some constants
LXC_PATH_LIB = "/var/lib/lxc" LXC_PATH_LIB = "@LXCPATH@"
LXC_TEMPLATE = "ubuntu" LXC_TEMPLATE = "ubuntu"
# Let's pick a random name, avoiding clashes # Let's pick a random name, avoiding clashes
......
...@@ -465,7 +465,7 @@ def list_containers(as_object=False): ...@@ -465,7 +465,7 @@ def list_containers(as_object=False):
List the containers on the system. List the containers on the system.
""" """
containers = [] containers = []
for entry in glob.glob("/var/lib/lxc/*/config"): for entry in glob.glob("@LXCPATH@/*/config"):
if as_object: if as_object:
containers.append(Container(entry.split("/")[-2])) containers.append(Container(entry.split("/")[-2]))
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment