1 | name: Restore (full) |
2 | |
3 | args: |
4 | - |
5 | name: backup.blob |
6 | label: Backup to restore |
7 | input_type: text |
8 | python_type: str |
9 | placeholder: Enter blob id |
10 | meta: |
11 | seals: |
12 | - urn/seal/user/svnplace/Backup - Full |
13 | - "{repo.seal.api_id}" |
14 | allow_write: false |
15 | |
16 | |
17 | role: |
18 | policies: |
19 | - urn/api/policy/svnplace/Allow Everything |
20 | parents: |
21 | - urn/api/role/{user.username}/ |
22 | - urn/api/role/svnplace/Backup Restorer |
23 | |
24 | jobs: |
25 | |
26 | setup: |
27 | steps: |
28 | - |
29 | name: Setup |
30 | python: | |
31 | blob = '{escape(backup.blob)}' |
32 | print(f'Restoring backup {{blob} to {repo.urn}') |
33 | from datetime import datetime, timezone |
34 | import os |
35 | import subprocess |
36 | from api_api import API |
37 | |
38 | api = API('https://svnplace.com/api', ['~/.svnplace/config']) |
39 | |
40 | root = api.repos.create_reporepository( |
41 | repo='{repo.urn}', |
42 | kind='BackupRestoration', |
43 | name='Restore$'+datetime.now(timezone.utc).strftime('%Y%m%d_%H%M.%f'), |
44 | process='urn/process/process/svnplace/processes/12/repo_from_backup.yaml', |
45 | input={{'blob': blob}, |
46 | ) |
47 | |