mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-28 02:20:42 +00:00
neon_local init: add --force mode that allows an empty dir
This will be useful to prepare repo_dir snapshot in an empty overlayfs mount. (Think Dockerfile `FROM scratch`.)
This commit is contained in:
@@ -473,6 +473,7 @@ class NeonEnvBuilder:
|
||||
self.test_output_dir = test_output_dir
|
||||
self.test_overlay_dir = test_overlay_dir
|
||||
self.overlay_mounts_created_by_us: List[Tuple[str, Path]] = []
|
||||
self.config_init_force: Optional[str] = None
|
||||
|
||||
assert test_name.startswith(
|
||||
"test_"
|
||||
@@ -911,7 +912,7 @@ class NeonEnv:
|
||||
cfg["safekeepers"].append(sk_cfg)
|
||||
|
||||
log.info(f"Config: {cfg}")
|
||||
self.neon_cli.init(cfg)
|
||||
self.neon_cli.init(cfg, force=config.config_init_force)
|
||||
|
||||
def start(self):
|
||||
# Start up broker, pageserver and all safekeepers
|
||||
@@ -1399,6 +1400,7 @@ class NeonCli(AbstractNeonCli):
|
||||
def init(
|
||||
self,
|
||||
config: Dict[str, Any],
|
||||
force: Optional[str] = None,
|
||||
) -> "subprocess.CompletedProcess[str]":
|
||||
with tempfile.NamedTemporaryFile(mode="w+") as tmp:
|
||||
tmp.write(toml.dumps(config))
|
||||
@@ -1406,6 +1408,9 @@ class NeonCli(AbstractNeonCli):
|
||||
|
||||
cmd = ["init", f"--config={tmp.name}", "--pg-version", self.env.pg_version]
|
||||
|
||||
if force is not None:
|
||||
cmd.extend(["--force", force])
|
||||
|
||||
storage = self.env.pageserver_remote_storage
|
||||
|
||||
append_pageserver_param_overrides(
|
||||
|
||||
Reference in New Issue
Block a user