-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunMPSDbackup.py
31 lines (29 loc) · 1.05 KB
/
runMPSDbackup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# launch file
import MPSDbackup2ObjectStore.backupMPSD as backupMPSD
import logging, os
# configure the logger
# message level, message string output format, handler for console
# these messages write to the Jenkins console
str_Fmt = ("%(asctime)s - %(name)s - %(levelname)s -"
"line %(lineno)d\nmsg: %(message)s\n")
logging.basicConfig(
level=logging.DEBUG,
format=str_Fmt,
handlers=[logging.StreamHandler()]
)
# instantiate logger
LOGGER = logging.getLogger(__name__)
LOGGER.debug("process start - runMPSDbackup.py")
backup_File = backupMPSD.BackupMPSD().createBackupFile()
# check to make sure the backup file exist, write to log if it doesn't
if os.path.exists(backup_File):
LOGGER.debug(f"backup file created")
else:
LOGGER.error(f"BACKUP FILE NOT CREATED")
# check to make sure the backup file was copied
LOGGER.debug("Copying Backup File to S3 Bucket")
try:
backupMPSD.ObjectStore.copyBackupFile(backup_File)
LOGGER.debug(f"backup file copied to S3 bucket")
except:
LOGGER.error(f"BACKUP FILE NOT COPIED TO S3 BUCKET")