def testGetConfig(self, run_mock): configService = Config("/fake/path") settings = configService.getConfig() targetSettings = { 'mysql': { 'image': 'fake/image', 'command': 'facke command' } } self.assertEqual(settings, targetSettings) configService = Config() settings = configService.getConfig() self.assertEqual(settings, targetSettings)
sys.exit(1) try: configService = Config("config/*.yml") 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)