Rename VOLUME_DIR to VOLUMES_DIR
This commit is contained in:
parent
e71514c6f9
commit
31a973ee03
@ -8,7 +8,7 @@ import shlex
|
|||||||
from spoc import repo_local
|
from spoc import repo_local
|
||||||
from spoc.container import Container, State
|
from spoc.container import Container, State
|
||||||
from spoc.image import Image
|
from spoc.image import Image
|
||||||
from spoc.config import VOLUME_DIR
|
from spoc.config import VOLUMES_DIR
|
||||||
|
|
||||||
def listing(state):
|
def listing(state):
|
||||||
if state == 'all':
|
if state == 'all':
|
||||||
@ -36,7 +36,7 @@ def modify_mount(container, mount):
|
|||||||
mountpoint = mountpoint.lstrip('/')
|
mountpoint = mountpoint.lstrip('/')
|
||||||
if mountpoint:
|
if mountpoint:
|
||||||
# If the volume doesn't exist yet, assume it will be a directory
|
# 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)
|
container.mounts[volume] = (mountpoint, is_dir)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -13,7 +13,7 @@ DATA_DIR = config.get('general', 'data-dir', fallback='/var/lib/spoc/')
|
|||||||
APPS_DIR = os.path.join(DATA_DIR, 'apps/')
|
APPS_DIR = os.path.join(DATA_DIR, 'apps/')
|
||||||
CONTAINERS_DIR = os.path.join(DATA_DIR, 'containers/')
|
CONTAINERS_DIR = os.path.join(DATA_DIR, 'containers/')
|
||||||
LAYERS_DIR = os.path.join(DATA_DIR, 'layers/')
|
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')
|
HOSTS_FILE = os.path.join(DATA_DIR, 'hosts')
|
||||||
REPO_FILE = os.path.join(DATA_DIR, 'repository.json')
|
REPO_FILE = os.path.join(DATA_DIR, 'repository.json')
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from . import network
|
|||||||
from . import repo_local
|
from . import repo_local
|
||||||
from .depsolver import DepSolver
|
from .depsolver import DepSolver
|
||||||
from .exceptions import InvalidContainerStateError
|
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
|
from .templates import LXC_CONTAINER_TEMPLATE
|
||||||
|
|
||||||
# States taken from https://github.com/lxc/lxc/blob/master/src/lxc/state.h
|
# 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
|
# 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)
|
os.chown(self.ephemeral_layer_path, 100000, 100000)
|
||||||
# Create container configuration file based on the container definition
|
# 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()])
|
env = '\n'.join([f'lxc.environment = {k}={v}' for k,v in self.env.items()])
|
||||||
uid = self.uid if self.uid else 0
|
uid = self.uid if self.uid else 0
|
||||||
gid = self.gid if self.gid else 0
|
gid = self.gid if self.gid else 0
|
||||||
|
Loading…
Reference in New Issue
Block a user