From 3f206fa6f36da486034c511b6ba1a2c9483ebece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 7 Mar 2023 16:34:27 -0300 Subject: [PATCH] =?UTF-8?q?Remove=20bug=20que=20fazia=20dom=C3=ADnios=20ho?= =?UTF-8?q?spedados=20no=20Interlegis=20fossem=20processados=20como=20dele?= =?UTF-8?q?gados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../servicos/jobs/daily/sincroniza_dns.py | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/sigi/apps/servicos/jobs/daily/sincroniza_dns.py b/sigi/apps/servicos/jobs/daily/sincroniza_dns.py index 8fa03e1..41738a1 100644 --- a/sigi/apps/servicos/jobs/daily/sincroniza_dns.py +++ b/sigi/apps/servicos/jobs/daily/sincroniza_dns.py @@ -65,11 +65,16 @@ class Job(JobReportMixin, DailyJob): user=self.sys_user, ) + # Remove arquivo ZONES, desnecessário para este processo # + zones_file = settings.REGISTRO_PATH / "ZONES" + if zones_file.exists() and zones_file.is_file(): + zones_file.unlink() + for uf in UnidadeFederativa.objects.all(): self.report_data[uf] = get_log_entry() self.processa_uf(uf) - self.processa_zones() + # self.processa_zones() self.processa_files() try: @@ -224,29 +229,29 @@ class Job(JobReportMixin, DailyJob): # Remove arquivo da UF # file_path.unlink() - def processa_zones(self): - zones_file = settings.REGISTRO_PATH / "ZONES" - if not zones_file.exists() or not zones_file.is_file(): - self.error( - _( - f"Arquivo de zonas {zones_file} não encontrado ou " - "não é arquivo" - ) - ) - return - data = json.loads(zones_file.read_text()) - for rec in data: - dominio = rec["name"][:-1] - self.processa_rec(rec) - detail_file = settings.REGISTRO_PATH / f"{dominio}." - if ( - detail_file != zones_file - and detail_file.exists() - and detail_file.is_file() - ): - detail_file.unlink() - - zones_file.unlink() + # def processa_zones(self): + # zones_file = settings.REGISTRO_PATH / "ZONES" + # if not zones_file.exists() or not zones_file.is_file(): + # self.error( + # _( + # f"Arquivo de zonas {zones_file} não encontrado ou " + # "não é arquivo" + # ) + # ) + # return + # data = json.loads(zones_file.read_text()) + # for rec in data: + # dominio = rec["name"][:-1] + # self.processa_rec(rec) + # detail_file = settings.REGISTRO_PATH / f"{dominio}." + # if ( + # detail_file != zones_file + # and detail_file.exists() + # and detail_file.is_file() + # ): + # detail_file.unlink() + + # zones_file.unlink() def processa_files(self): file_list = list(settings.REGISTRO_PATH.iterdir())