Merge branch 'main' of github.com:kevinveenbirkenbach/docker-volume-backup

This commit is contained in:
Kevin Veen-Birkenbach 2024-12-03 11:19:40 +01:00
commit f847c8dd74

View File

@ -57,15 +57,16 @@ IMAGES_NO_BACKUP_REQUIRED = [
'memcached' 'memcached'
] ]
DIRNAME = os.path.dirname(__file__) # DEFINE CONSTANTS
DIRNAME = os.path.dirname(__file__)
DATABASES = pandas.read_csv(os.path.join(DIRNAME, "databases.csv"), sep=";") SCRIPTS_DIRECTORY = pathlib.Path(os.path.realpath(__file__)).parent.parent
REPOSITORY_NAME = os.path.basename(DIRNAME) DATABASES = pandas.read_csv(os.path.join(DIRNAME, "databases.csv"), sep=";")
MACHINE_ID = get_machine_id() REPOSITORY_NAME = os.path.basename(DIRNAME)
BACKUPS_DIR = '/Backups/' MACHINE_ID = get_machine_id()
VERSIONS_DIR = os.path.join(BACKUPS_DIR, MACHINE_ID, REPOSITORY_NAME) BACKUPS_DIR = '/Backups/'
BACKUP_TIME = datetime.now().strftime("%Y%m%d%H%M%S") VERSIONS_DIR = os.path.join(BACKUPS_DIR, MACHINE_ID, REPOSITORY_NAME)
VERSION_DIR = create_version_directory() BACKUP_TIME = datetime.now().strftime("%Y%m%d%H%M%S")
VERSION_DIR = create_version_directory()
def get_instance(container): def get_instance(container):
# The function is defined to take one parameter, 'container', # The function is defined to take one parameter, 'container',
@ -93,7 +94,7 @@ def get_instance(container):
def stamp_directory(): def stamp_directory():
"""Stamp a directory using directory-validator.""" """Stamp a directory using directory-validator."""
stamp_command = f"python ../directory-validator/directory-validator.py --stamp {VERSION_DIR}" stamp_command = f"python {SCRIPTS_DIRECTORY}/directory-validator/directory-validator.py --stamp {VERSION_DIR}"
try: try:
execute_shell_command(stamp_command) execute_shell_command(stamp_command)
print(f"Successfully stamped directory: {VERSION_DIR}") print(f"Successfully stamped directory: {VERSION_DIR}")