Allow passing initial timeline id into zenith CLI commands

This commit is contained in:
Kirill Bulatov
2022-02-24 20:35:41 +02:00
committed by Kirill Bulatov
parent 4d0f7fd1e4
commit c7569dce47
8 changed files with 192 additions and 69 deletions

View File

@@ -869,12 +869,16 @@ class ZenithCli:
res.stdout.strip().split("\n")))
return branches_cli
def init(self, config_toml: str) -> 'subprocess.CompletedProcess[str]':
def init(self,
config_toml: str,
initial_timeline_id: Optional[uuid.UUID] = None) -> 'subprocess.CompletedProcess[str]':
with tempfile.NamedTemporaryFile(mode='w+') as tmp:
tmp.write(config_toml)
tmp.flush()
cmd = ['init', f'--config={tmp.name}']
if initial_timeline_id:
cmd.extend(['--timeline-id', initial_timeline_id.hex])
append_pageserver_param_overrides(cmd,
self.env.pageserver.remote_storage,
self.env.pageserver.config_override)