Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dockerfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Picasoft
Technique
Dockerfiles
Commits
9a01887d
Commit
9a01887d
authored
7 years ago
by
Alexandre-Guillaume Gilbert
Browse files
Options
Downloads
Patches
Plain Diff
Write backup_env_var.py comments in english
parent
e8b62cf6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
[TX-INFRA-P18] Add images for pica-backupv2 and backup-rotation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db-backup/backup_env_var.py
+11
-8
11 additions, 8 deletions
db-backup/backup_env_var.py
with
11 additions
and
8 deletions
db-backup/backup_env_var.py
+
11
−
8
View file @
9a01887d
...
...
@@ -3,7 +3,7 @@ import os
import
sys
import
json
#
Ajout
e
l
a variable
correctement dans une variable d'
environ
ne
ment
#
Tak
e 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 dossier
s
#
Check if config file exist
s
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
()
#
I
nitiali
s
ation
des variables
#
Variables i
nitiali
z
ation
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
#
Ex
ce
cution
of run.sh after creating all environment variables from .json file
os
.
execv
(
"
/scripts/run.sh
"
,[
''
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment