Rename VOLUME_DIR to VOLUMES_DIR

This commit is contained in:
Disassembler 2020-02-22 15:16:04 +01:00
parent e71514c6f9
commit 31a973ee03
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
3 changed files with 5 additions and 5 deletions

View File

@ -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:

View File

@ -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')

View File

@ -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