summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/cache.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/utils/cache.py b/src/utils/cache.py
index 6358c6a..ea32f8b 100644
--- a/src/utils/cache.py
+++ b/src/utils/cache.py
@@ -19,16 +19,13 @@ OG_CACHE_IMAGE_PATH = OG_CACHE_PATH + OG_IMAGE_PATH
OGCLIENT_LOG_CACHE='/opt/opengnsys/log/{ip}.cache.txt'
def mount_cache():
- """
- Probes for cache and mounts if succesful.
-
- Returns the mountpoint or an empty string.
- """
cache_dev = get_cache_dev_path()
if cache_dev:
- # cache_target = cache_dev.replace('dev', 'mnt')
- mount_mkdir(cache_dev, OG_CACHE_PATH)
+ cache_mounted = mount_mkdir(cache_dev, OG_CACHE_PATH)
+
+ if cache_mounted and not os.path.exists(OG_CACHE_IMAGE_PATH):
+ os.makedirs(OG_CACHE_IMAGE_PATH)
return OG_CACHE_PATH
return ''
@@ -69,15 +66,3 @@ def generate_cache_txt():
return
content = ','.join(files)
write_cache_txt(content)
-
-
-def init_cache():
- """
- If a cache partition is present, creates the following directories
- /opt/opengnsys/images. This is the default folder in which images
- are stored when using tiptorrent-cache.
- """
- mountpoint = mount_cache()
- if mountpoint:
- logging.info(f'Creating cache directory at {mountpoint}')
- os.makedirs(f'{mountpoint}/opt/opengnsys/images')