mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:07:08 +00:00
A configuration item `imports.mounts` is added to `etc/config.yaml`. This should be a list of paths which must be non-empty. If any of the paths in that list is empty, runner.sh will abort. Closes #200.
28 lines
524 B
Python
Executable File
28 lines
524 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
"""
|
|
Check if any of the directories provided in the imports.mounts configuration
|
|
section are empty.
|
|
|
|
Returns 0 if all arguments are non-empty, 1 otherwise. It stops at the first
|
|
empty directory.
|
|
"""
|
|
|
|
import os
|
|
import configuration
|
|
|
|
cfg = configuration.read()
|
|
|
|
if cfg and "imports" in cfg and "mounts" in cfg["imports"]:
|
|
|
|
mounts = cfg["imports"]["mounts"]
|
|
for item in mounts:
|
|
with os.scandir(item) as contents:
|
|
if not any(contents):
|
|
exit(1)
|
|
|
|
else:
|
|
print("No mounts in configuration")
|
|
|
|
exit(0)
|