def update_procedure_file(procedure): """Procedure update file""" name = procedure.bacula_name filename = join(settings.NIMBUS_JOBS_DIR, name) render_to_file(filename, "job", name=name, schedule=procedure.schedule_bacula_name(), storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), priority="10", active=procedure.active, client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name() ) update_pool_file(procedure) if not exists(settings.NIMBUS_RESTORE_FILE): render_to_file(settings.NIMBUS_RESTORE_FILE, "restore", name=name + "restore", storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name()) reload_manager = ReloadManager() reload_manager.force_reload()
def update_procedure_file(procedure): """Procedure update file""" name = procedure.bacula_name verbose_name = procedure.name filename = join(settings.NIMBUS_JOBS_DIR, name) render_to_file(filename, "job", name=name, verbose_name=verbose_name, schedule=procedure.schedule_bacula_name(), storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), priority="10", active=procedure.active, # NIMBUS_EXE=settings.NIMBUS_EXE, client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name(), job_tasks=procedure.job_tasks.filter(active=True), ) update_pool_file(procedure) if not exists(settings.NIMBUS_RESTORE_FILE): render_to_file(settings.NIMBUS_RESTORE_FILE, "restore", name=name + "restore", storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name())
def update_procedure_file(procedure): """Procedure update file""" name = procedure.bacula_name verbose_name = procedure.name filename = join(settings.NIMBUS_JOBS_DIR, name) render_to_file( filename, "job", name=name, verbose_name=verbose_name, schedule=procedure.schedule_bacula_name(), storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), priority="10", active=procedure.active, # NIMBUS_EXE=settings.NIMBUS_EXE, client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name(), job_tasks=procedure.job_tasks.filter(active=True), ) update_pool_file(procedure) if not exists(settings.NIMBUS_RESTORE_FILE): render_to_file(settings.NIMBUS_RESTORE_FILE, "restore", name=name + "restore", storage=procedure.storage_bacula_name(), fileset=procedure.fileset_bacula_name(), client=procedure.computer.bacula_name, pool=procedure.pool_bacula_name())
def update_computer_file(computer): """Computer update file""" if computer.active: name = computer.bacula_name filename = path.join( settings.NIMBUS_COMPUTERS_DIR, name) render_to_file(filename, "client", name=name, ip=computer.address, password=computer.password)
def update_pool_file(procedure): """Pool update pool bacula file""" name = procedure.pool_bacula_name() filename = path.join(settings.NIMBUS_POOLS_DIR, name) render_to_file(filename, "pool", name=name, max_vol_bytes=procedure.pool_size, days=procedure.pool_retention_time)
def update_schedule_file(schedule): name = schedule.bacula_name filename = path.join(settings.NIMBUS_SCHEDULES_DIR, name) render_to_file(filename, "schedule", name=name, runs=schedule.runs.all())
def update_computer_file(computer): """Computer update file""" if computer.active: name = computer.bacula_name filename = path.join(settings.NIMBUS_COMPUTERS_DIR, name) render_to_file(filename, "client", name=name, ip=computer.address, password=computer.password)
def update_console_file(config): """Update bconsole file""" filename = settings.BCONSOLE_CONF render_to_file(filename, "bconsole", director_name=config.director_name, director_address=config.director_address, director_password=config.director_password, director_port=9101) logger = logging.getLogger(__name__) logger.info("Arquivo de configuracao do bconsole gerado com sucesso")
def update_fileset_file(fileset): """FileSet update filesets to a procedure instance""" name = fileset.bacula_name verbose_name = fileset.name filename = path.join(settings.NIMBUS_FILESETS_DIR, name) files = [f.path for f in fileset.files.all()] includes = [w.expression for w in fileset.includes] excludes = [w.expression for w in fileset.excludes] render_to_file(filename, "fileset", name=name, files=files, includes=includes, excludes=excludes, verbose_name=verbose_name)
def update_director_file(config): """Generate director file""" filename = settings.BACULADIR_CONF render_to_file(filename, "bacula-dir", director_name=config.director_name, director_password=config.director_password, db_name=settings.DATABASES['bacula']['NAME'], db_user=settings.DATABASES['bacula']['USER'], db_password=settings.DATABASES['bacula']['PASSWORD'], computers_dir=settings.NIMBUS_COMPUTERS_DIR, filesets_dir=settings.NIMBUS_FILESETS_DIR, jobs_dir=settings.NIMBUS_JOBS_DIR, pools_dir=settings.NIMBUS_POOLS_DIR, schedules_dir=settings.NIMBUS_SCHEDULES_DIR, storages_dir=settings.NIMBUS_STORAGES_DIR) logger = logging.getLogger(__name__) logger.info("Arquivo de configuracao do director gerado com sucesso")
def update_device_file(device): try: if device.storage.active: name = device.bacula_name storagename = device.storage.bacula_name filename = path.join(settings.NIMBUS_DEVICES_DIR, name) storagefile = path.join(settings.NIMBUS_STORAGES_DIR, storagename) render_to_file(filename, "device", name=name, archive_device=device.archive) render_to_file(storagefile, "storages", devices=Device.objects.all()) except Storage.DoesNotExist: pass #loaddata
def update_storage_file(storage): """Update storage File""" filename = settings.BACULASD_CONF if storage.is_local and storage.active: try: logger = logging.getLogger(__name__) config = Config.objects.get(id=1) render_to_file( filename, "bacula-sd", name=storage.bacula_name, port=9103, max_cur_jobs=100, director_name=config.director_name, director_password=storage.password, devices_dir=settings.NIMBUS_DEVICES_DIR) logger.info("Arquivo de configuracao do storage gerado com sucesso") except Config.DoesNotExist, error: logger.info("Config does not exist")
def update_storage_file(storage): """Update storage File""" filename = settings.BACULASD_CONF if storage.is_local and storage.active: try: logger = logging.getLogger(__name__) config = Config.objects.get(id=1) render_to_file(filename, "bacula-sd", name=storage.bacula_name, port=9103, max_cur_jobs=100, director_name=config.director_name, director_password=storage.password, devices_dir=settings.NIMBUS_DEVICES_DIR) logger.info( "Arquivo de configuracao do storage gerado com sucesso") except Config.DoesNotExist, error: logger.info("Config does not exist")
def update_device_file(device): try: if device.storage.active: name = device.bacula_name storagename = device.storage.bacula_name filename = path.join( settings.NIMBUS_DEVICES_DIR, name) storagefile = path.join( settings.NIMBUS_STORAGES_DIR, storagename) render_to_file( filename, "device", name=name, archive_device=device.archive) render_to_file( storagefile, "storages", devices=Device.objects.all()) except Storage.DoesNotExist: pass #loaddata
def update_fileset_file(fileset): """FileSet update filesets to a procedure instance""" name = fileset.bacula_name filename = path.join(settings.NIMBUS_FILESETS_DIR, name) files = [f.path for f in fileset.files.all()] render_to_file(filename, "fileset", name=name, files=files)