Пример #1
0
 def testInitDuplicity(self, mock_runCmd):
     backupService = Backup()
     backupService.initDuplicity(
         '/backup', 'ftp://*****:*****@my-server.com/backup/dump')
     mock_runCmd.assert_any_call(
         mock.ANY,
         'duplicity --no-encryption ftp://user:[email protected]/backup/dump /backup'
     )
Пример #2
0
            (settings, rancherDatabaseSettings) = getAndcheckAllParameters()
        except Exception as e:
            logger.error("Error - %s", e.message)
            sys.exit(1)

        backupService = Backup()
        rancherService = Rancher()
        backend = "%s%s" % (settings['duplicity']['url'],
                            settings['duplicity']['target-path'])

        try:
            # We init duplicity
            if os.getenv("BACKUP_DUPLICITY_enable") == "true":
                try:
                    logger.info("Start to initialize Duplicity...")
                    backupService.initDuplicity(
                        settings['duplicity']['source-path'], backend)
                    logger.info("Duplicity initialization is finished.")
                except Exception as e:
                    logger.info(
                        "No backup found (probably the first) or already initialized"
                    )
                    pass
            else:
                logger.info("Duplicity disabled...")

            # We dump the databases services if needed
            if settings['module']['databases'] is True:
                logger.info("Start to dump databases...")
                listServices = rancherService.getServices()
                listDump = backupService.searchDump(
                    settings['duplicity']['source-path'] + '/dump',
Пример #3
0
    except Exception as e:
        logger.error("Can't load settings or syntax errors : %s", e.message)
        logger.error(traceback.format_exc())
        sys.exit(1)

    backupService = Backup()
    backend = os.getenv('BACKEND') + TARGET_PATH

    try:

        # Load settings
        listSettings = configService.getConfig()

        # We init duplicity
        try:
            backupService.initDuplicity(BACKUP_PATH, backend)
        except Exception as e:
            logger.info(
                "No backup found (probably the first) or already initialized")
            pass

        # We dump the container if needed
        # Get all services (potential dump)
        if DISABLE_DUMP != "true":
            listServices = rancherService.getServices()
            listDump = backupService.searchDump(BACKUP_PATH, listServices,
                                                listSettings)
            backupService.runDump(listDump)

        # We dump the rancher settings
        if DISABLE_DUMP_RANCHER != "true":