diff --git a/usr/bin/spoc-container b/usr/bin/spoc-container index 4546ddb..545d177 100644 --- a/usr/bin/spoc-container +++ b/usr/bin/spoc-container @@ -8,7 +8,7 @@ import shlex from spoc import repo_local from spoc.container import Container, State from spoc.image import Image -from spoc.config import VOLUME_DIR +from spoc.config import VOLUMES_DIR def listing(state): if state == 'all': @@ -36,7 +36,7 @@ def modify_mount(container, mount): mountpoint = mountpoint.lstrip('/') if mountpoint: # If the volume doesn't exist yet, assume it will be a directory - is_dir = not os.path.isfile(os.path.join(VOLUME_DIR, volume)) + is_dir = not os.path.isfile(os.path.join(VOLUMES_DIR, volume)) container.mounts[volume] = (mountpoint, is_dir) else: try: diff --git a/usr/lib/python3.8/spoc/config.py b/usr/lib/python3.8/spoc/config.py index 1ee17b0..2ccb38e 100644 --- a/usr/lib/python3.8/spoc/config.py +++ b/usr/lib/python3.8/spoc/config.py @@ -13,7 +13,7 @@ DATA_DIR = config.get('general', 'data-dir', fallback='/var/lib/spoc/') APPS_DIR = os.path.join(DATA_DIR, 'apps/') CONTAINERS_DIR = os.path.join(DATA_DIR, 'containers/') LAYERS_DIR = os.path.join(DATA_DIR, 'layers/') -VOLUME_DIR = os.path.join(DATA_DIR, 'volumes/') +VOLUMES_DIR = os.path.join(DATA_DIR, 'volumes/') HOSTS_FILE = os.path.join(DATA_DIR, 'hosts') REPO_FILE = os.path.join(DATA_DIR, 'repository.json') diff --git a/usr/lib/python3.8/spoc/container.py b/usr/lib/python3.8/spoc/container.py index 507fc84..78a4aa7 100644 --- a/usr/lib/python3.8/spoc/container.py +++ b/usr/lib/python3.8/spoc/container.py @@ -13,7 +13,7 @@ from . import network from . import repo_local from .depsolver import DepSolver from .exceptions import InvalidContainerStateError -from .config import CONTAINERS_DIR, LAYERS_DIR, LOG_DIR, HOSTS_FILE, VOLUME_DIR +from .config import CONTAINERS_DIR, LAYERS_DIR, LOG_DIR, HOSTS_FILE, VOLUMES_DIR from .templates import LXC_CONTAINER_TEMPLATE # States taken from https://github.com/lxc/lxc/blob/master/src/lxc/state.h @@ -117,7 +117,7 @@ class Container: # Chown is possible only when the process is running as root, for user namespaces, see https://linuxcontainers.org/lxc/manpages/man1/lxc-usernsexec.1.html os.chown(self.ephemeral_layer_path, 100000, 100000) # Create container configuration file based on the container definition - mounts = '\n'.join([f'lxc.mount.entry = {os.path.join(VOLUME_DIR, v)} {m[0]} none bind,create={"dir" if m[1] else "file"} 0 0' for v,m in self.mounts.items()]) + mounts = '\n'.join([f'lxc.mount.entry = {os.path.join(VOLUMES_DIR, v)} {m[0]} none bind,create={"dir" if m[1] else "file"} 0 0' for v,m in self.mounts.items()]) env = '\n'.join([f'lxc.environment = {k}={v}' for k,v in self.env.items()]) uid = self.uid if self.uid else 0 gid = self.gid if self.gid else 0