Files
Investidor-V2/outputs/investmoz-legado-ativacao-20261015/import-authorized-pilot.py
T
nala 6a76aac80f
tests / ci (push) Canceled after 0s
versao compilada 1
2026-10-16 09:17:28 +02:00

6 lines
1.4 KiB
Python

from pathlib import Path
import json,subprocess,os,hashlib,datetime
r=Path.cwd();o=r/'outputs/investmoz-legado-ativacao-20261015';backup=json.loads((o/'FRESH-BACKUP.json').read_text());proof=Path(backup['private_directory'])/'backup-proof-private.json';php='C:/laragon/bin/php/php-8.5.11-Win32-vs17-x64/php.exe';env=os.environ.copy();env['QUEUE_CONNECTION']='sync';base=[php,'artisan','documents:import-batch','legacy-agronegocio/manifest.json','--pilot-agronegocio','--actor=2'];assert not (o/'IMPORT-APPLY.json').exists()
p=subprocess.run(base,cwd=r,env=env,text=True,capture_output=True);(o/'IMPORT-PREVIEW.txt').write_text(p.stdout+p.stderr,encoding='utf-8');assert p.returncode==0,p.stdout+p.stderr
p=subprocess.run(base+['--apply','--backup-proof='+str(proof)],cwd=r,env=env,text=True,capture_output=True);(o/'IMPORT-APPLY.txt').write_text(p.stdout+p.stderr,encoding='utf-8');v={'at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'exit':p.returncode,'actor_id':2,'method':'Explicitly authorized named pilot CLI; effective manage-portal checked by importer; actor attribution does not create browser authentication','private_only':True,'scan':'Existing job executed synchronously only for the two new originals; no queue-wide processing','backup_receipt_sha256':hashlib.sha256(proof.read_bytes()).hexdigest()};(o/'IMPORT-APPLY.json').write_text(json.dumps(v,indent=2)+'\n');print(p.stdout+p.stderr);assert p.returncode==0