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 create_database(self): call_command('syncdb',verbosity=0,interactive=False) if len(User.objects.all()) == 0: u = User(username = "******", is_superuser=True, email = "*****@*****.**") u.set_password("admin") u.save() call_command('loaddata', settings.INITIALDATA_FILE) config = Config.get_instance() config.director_password = utils.random_password() config.save() storage = Storage.objects.get(id=1) storage.password = utils.random_password() storage.save() computer = Computer.objects.get(id=1) computer.activate() register_administrative_nimbus_models() reload_manager = ReloadManager() reload_manager.force_reload() else: force_unlock_bacula_and_start()
def create_database(self): call_command('syncdb', verbosity=0, interactive=False) if len(User.objects.all()) == 0: u = User(username="******", is_superuser=True, email="*****@*****.**") u.set_password("admin") u.save() call_command('loaddata', settings.INITIALDATA_FILE) config = Config.get_instance() config.director_password = utils.random_password() config.save() storage = Storage.objects.get(id=1) storage.password = utils.random_password() storage.save() computer = Computer.objects.get(id=1) computer.activate() register_administrative_nimbus_models() reload_manager = ReloadManager() reload_manager.force_reload() else: force_unlock_bacula_and_start()
def remove_procedure_volumes(procedure): pool_name = procedure.pool_bacula_name() medias = Media.objects.filter(pool__name=pool_name).distinct() volumes = [m.volumename for m in medias] try: bacula = Bacula() bacula.cancel_procedure(procedure) bacula.purge_volumes(volumes, pool_name) bacula.truncate_volumes(pool_name) bacula.delete_pool(pool_name) for volume in volumes: volume_abs_path = join(settings.NIMBUS_DEFAULT_ARCHIVE, volume) if exists(volume_abs_path): os.remove(volume_abs_path) reload_manager = ReloadManager() reload_manager.force_reload() except BConsoleInitError, error: logger = logging.getLogger(__name__) logger.exception("Erro na comunicação com o bacula")
def function_wrapper(sender, instance, signal, *args, **kwargs): value = function(instance) reload_manager = ReloadManager() reload_manager.add_reload_request() return value