letsencrypt - use same job name when retrieving data from db

This commit is contained in:
bunkerity 2023-06-15 18:09:39 +02:00
parent 9e00b9dd13
commit 94867d0d63
2 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ try:
sqlalchemy_string=getenv("DATABASE_URI", None),
)
tgz = get_file_in_db("folder.tgz", db)
tgz = get_file_in_db("folder.tgz", db, job_name="certbot-renew")
if tgz:
# Delete folder if needed
if letsencrypt_path.exists():

View File

@ -70,9 +70,9 @@ def is_cached_file(
return is_cached and cached_file
def get_file_in_db(file: Union[str, Path], db) -> Optional[bytes]:
def get_file_in_db(file: Union[str, Path], db, *, job_name: Optional[str] = None) -> Optional[bytes]:
cached_file = db.get_job_cache_file(
basename(getsourcefile(_getframe(1))).replace(".py", ""), normpath(file)
job_name or basename(getsourcefile(_getframe(1))).replace(".py", ""), normpath(file)
)
if not cached_file:
return None