Allow isolated restores under protected recovery storage
Assistant: codex Assistant-Model: gpt-6.1-sol Assistant-Session: 01a18e2d-f513-7742-b8e7-12af0b744ff3
This commit is contained in:
parent
b3094ee8d0
commit
360b6bdd69
1 changed files with 5 additions and 1 deletions
|
|
@ -85,7 +85,11 @@ def main() -> int:
|
|||
help='Local PostgreSQL image/digest; use the retained kit image ID offline')
|
||||
parser.add_argument('--keep-instance', action='store_true',
|
||||
help='Keep the isolated internal network/database for a content rehearsal')
|
||||
parser.add_argument('--work-root', type=Path, default=Path('/tmp'),
|
||||
help='Existing absolute parent for the private restored content directory')
|
||||
args = parser.parse_args()
|
||||
if not args.work_root.is_absolute() or not args.work_root.is_dir():
|
||||
raise Refused('absolute_existing_work_root_required')
|
||||
source = args.snapshot.resolve()
|
||||
receipt = json.loads((source / 'receipt.json').read_text())
|
||||
if receipt.get('status') != 'captured' or not receipt.get('writers_quiesced'):
|
||||
|
|
@ -96,7 +100,7 @@ def main() -> int:
|
|||
started = time.monotonic()
|
||||
name = 'csoc-recovery-' + time.strftime('%Y%m%d%H%M%S', time.gmtime())
|
||||
network = name + '-net'
|
||||
work = Path(tempfile.mkdtemp(prefix=name + '-', dir='/tmp'))
|
||||
work = Path(tempfile.mkdtemp(prefix=name + '-', dir=args.work_root))
|
||||
image = run(['docker', 'image', 'inspect', args.postgres_image,
|
||||
'--format', '{{.Id}}']).decode().strip()
|
||||
if not re.fullmatch(r'sha256:[a-f0-9]{64}', image):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue