This commit is contained in:
Zsolt Ero
2024-09-12 13:23:27 +02:00
parent 04fcdfe028
commit 3bfa83a10c
3 changed files with 10 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ def auto_mount():
When finished, /mnt/ofm dir will have all the present tiles.btrfs files mounted in a read-only way. When finished, /mnt/ofm dir will have all the present tiles.btrfs files mounted in a read-only way.
""" """
print('running mount') print('Running auto mount')
assert_linux() assert_linux()
assert_sudo() assert_sudo()
@@ -28,6 +28,7 @@ def auto_mount():
def create_fstab(): def create_fstab():
print(' creating fstab')
fstab_new = [] fstab_new = []
for area in ['planet', 'monaco']: for area in ['planet', 'monaco']:
@@ -40,7 +41,7 @@ def create_fstab():
version_str = version.name version_str = version.name
btrfs_file = area_dir / version_str / 'tiles.btrfs' btrfs_file = area_dir / version_str / 'tiles.btrfs'
if not btrfs_file.is_file(): if not btrfs_file.is_file():
print(f" {btrfs_file} doesn't exists, skipping") print(f" {btrfs_file} doesn't exist, skipping")
continue continue
mnt_folder = config.mnt_dir / f'{area}-{version_str}' mnt_folder = config.mnt_dir / f'{area}-{version_str}'
@@ -60,7 +61,7 @@ def clean_up_mounts(mnt_dir):
if not mnt_dir.exists(): if not mnt_dir.exists():
return return
print(' cleaning up mounts') print('Cleaning up mounts')
# handle deleted files # handle deleted files
p = subprocess.run(['mount'], capture_output=True, text=True, check=True) p = subprocess.run(['mount'], capture_output=True, text=True, check=True)

View File

@@ -8,6 +8,8 @@ from http_host_lib.utils import python_venv_executable
def write_nginx_config(): def write_nginx_config():
print('Writing nginx config')
if not config.mnt_dir.exists(): if not config.mnt_dir.exists():
sys.exit(' mount needs to be run first') sys.exit(' mount needs to be run first')
@@ -166,14 +168,14 @@ def create_version_location(
) -> str: ) -> str:
run_dir = config.runs_dir / area / version run_dir = config.runs_dir / area / version
if not run_dir.is_dir(): if not run_dir.is_dir():
print(f" {run_dir} doesn't exists, skipping") print(f" {run_dir} doesn't exist, skipping")
return '' return ''
tilejson_path = run_dir / f'tilejson-{local}.json' tilejson_path = run_dir / f'tilejson-{local}.json'
metadata_path = mnt_dir / 'metadata.json' metadata_path = mnt_dir / 'metadata.json'
if not metadata_path.is_file(): if not metadata_path.is_file():
print(f" {metadata_path} doesn't exists, skipping") print(f" {metadata_path} doesn't exist, skipping")
return '' return ''
url_prefix = f'https://{domain}/{area}/{version}' url_prefix = f'https://{domain}/{area}/{version}'

View File

@@ -55,6 +55,8 @@ def auto_clean_btrfs():
3. If there is no deployed version, then we include the second newest one 3. If there is no deployed version, then we include the second newest one
""" """
print('Running auto clean btrfs')
for area in config.areas: for area in config.areas:
area_dir = config.runs_dir / area area_dir = config.runs_dir / area
if not area_dir.is_dir(): if not area_dir.is_dir():