Skip to content
Snippets Groups Projects
Commit 9a01887d authored by Alexandre-Guillaume Gilbert's avatar Alexandre-Guillaume Gilbert
Browse files

Write backup_env_var.py comments in english

parent e8b62cf6
No related branches found
No related tags found
1 merge request!7[TX-INFRA-P18] Add images for pica-backupv2 and backup-rotation
......@@ -3,7 +3,7 @@ import os
import sys
import json
#Ajoute la variable correctement dans une variable d'environnement
# Take a variable and set it as environment variable
def add_value_to_key(value, key):
if "MONGO" in key:
if(flag_mongo):
......@@ -25,7 +25,7 @@ CONFIG_FOLDER = '/config'
CONFIG_FILE = 'backup_data.json'
PATH_TO_CONFIG = CONFIG_FOLDER + '/' + CONFIG_FILE
#Garde-fou : test d'existence des fichiers et dossiers
# Check if config file exists
if not(os.path.exists(CONFIG_FOLDER)):
sys.stderr.write('Err: BACKUP_FOLDER or CONFIG_FOLDER doesn\'t exist. \n')
sys.exit()
......@@ -34,7 +34,7 @@ if not(os.path.isfile(PATH_TO_CONFIG)):
sys.stderr.write('Err: ' + PATH_TO_CONFIG + ' not found. \n')
sys.exit()
#Initialisation des variables
# Variables initialization
open_config_file = open(PATH_TO_CONFIG)
services_list = json.load(open_config_file)
flag_mongo = False
......@@ -43,7 +43,8 @@ flag_prostgres = False
for service in services_list:
if services_list[service]["Type"] == "mongo":
#Ajout des clés pour service à DDB Mongo
# Mongo DB handling
add_value_to_key(service,"MONGO_SERVICE_NAME_LIST")
add_value_to_key(services_list[service]["Host"],"MONGO_HOST_LIST")
add_value_to_key(services_list[service]["Port"],"MONGO_PORT_LIST")
......@@ -56,7 +57,8 @@ for service in services_list:
if services_list[service]["Type"] == "mysql":
#Ajout des clés pour service à DDB MySQL
# MySQL DB handling
add_value_to_key(service,"MYSQL_SERVICE_NAME_LIST")
add_value_to_key(services_list[service]["Host"],"MYSQL_HOST_LIST")
add_value_to_key(services_list[service]["Port"],"MYSQL_PORT_LIST")
......@@ -72,7 +74,8 @@ for service in services_list:
if services_list[service]["Type"] == "postgres":
#Ajout des clés pour service à DDB Postgre
# PostgreSQL handling
add_value_to_key(service,"POSTGRES_SERVICE_NAME_LIST")
add_value_to_key(services_list[service]["Host"],"POSTGRES_HOST_LIST")
add_value_to_key(services_list[service]["Port"],"POSTGRES_PORT_LIST")
......@@ -84,7 +87,7 @@ for service in services_list:
add_value_to_key(services_list[service]["Folder"],"POSTGRES_BACKUP_FOLDER_LIST")
flag_postgres = True
# Fermeture du fichier de configuration
# Closing config file
open_config_file.close()
#Exécution du script run.sh après avoir enregistré toutes les variables du fichier .json dans des variables d'environnement
# Excecution of run.sh after creating all environment variables from .json file
os.execv("/scripts/run.sh",[''])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment