Skip to content

Commit fdcb5f7

Browse files
Merge pull request #435 from math-inc/codex/public-empty-morph-args-20260328
fix(installer): support empty morph passthrough args
2 parents 63ad566 + dc5fb74 commit fdcb5f7

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

scripts/install.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ print_direct_start_hint() {
128128
printf 'Open Gauss is ready. Start with: gauss setup\n'
129129
}
130130

131+
run_local_template() {
132+
if [ "${#MORPH_ARGS[@]}" -gt 0 ]; then
133+
"$RUNNER_VENV/bin/morphcloud" devbox template run "$INSTALL_TARGET" --experimental-run-locally "${MORPH_ARGS[@]}"
134+
return
135+
fi
136+
"$RUNNER_VENV/bin/morphcloud" devbox template run "$INSTALL_TARGET" --experimental-run-locally
137+
}
138+
131139
parse_args "$@"
132140

133141
if ! command -v python3 >/dev/null 2>&1; then
@@ -148,7 +156,7 @@ fi
148156
uv pip install --python "$RUNNER_VENV/bin/python" morphcloud --upgrade
149157

150158
printf 'Running Open Gauss installer flow locally from target: %s\n' "$INSTALL_TARGET"
151-
"$RUNNER_VENV/bin/morphcloud" devbox template run "$INSTALL_TARGET" --experimental-run-locally "${MORPH_ARGS[@]}"
159+
run_local_template
152160
run_exit=$?
153161
if [ "$run_exit" -ne 0 ]; then
154162
exit "$run_exit"

tests/test_install_wrapper.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,73 @@ def test_install_wrapper_translates_installer_flags_for_local_template_run(tmp_p
128128
"GAUSS_SETUP_MODE": "skip",
129129
"GAUSS_RECREATE_VENV": "1",
130130
}
131+
132+
133+
def test_install_wrapper_supports_empty_morph_passthrough_on_bash_nounset(tmp_path):
134+
repo = tmp_path / "repo"
135+
scripts_dir = repo / "scripts"
136+
scripts_dir.mkdir(parents=True)
137+
shutil.copy2(REPO_ROOT / "scripts" / "install.sh", scripts_dir / "install.sh")
138+
139+
runner_bin = repo / ".opengauss-installer-venv" / "bin"
140+
runner_bin.mkdir(parents=True)
141+
_write_executable(
142+
runner_bin / "python",
143+
"""#!/usr/bin/env bash
144+
exit 0
145+
""",
146+
)
147+
148+
args_log = tmp_path / "morph-noargs.txt"
149+
_write_executable(
150+
runner_bin / "morphcloud",
151+
f"""#!/usr/bin/env bash
152+
set -euo pipefail
153+
printf '%s\\n' "$@" > "{args_log}"
154+
""",
155+
)
156+
157+
fake_bin = tmp_path / "bin"
158+
fake_bin.mkdir()
159+
_write_executable(
160+
fake_bin / "uv",
161+
"""#!/usr/bin/env bash
162+
set -euo pipefail
163+
exit 0
164+
""",
165+
)
166+
_write_executable(
167+
fake_bin / "tmux",
168+
"""#!/usr/bin/env bash
169+
set -euo pipefail
170+
exit 1
171+
""",
172+
)
173+
174+
env = os.environ.copy()
175+
env["PATH"] = f"{fake_bin}:{env['PATH']}"
176+
env["OPEN_GAUSS_AUTO_ATTACH"] = "0"
177+
178+
result = subprocess.run(
179+
[
180+
"bash",
181+
"scripts/install.sh",
182+
"--gauss-home",
183+
"/tmp/custom-gauss-home",
184+
"--workspace-dir",
185+
"/tmp/custom-workspace",
186+
"--skip-setup",
187+
],
188+
cwd=repo,
189+
env=env,
190+
text=True,
191+
capture_output=True,
192+
)
193+
assert result.returncode == 0, result.stderr + result.stdout
194+
assert args_log.read_text(encoding="utf-8").splitlines() == [
195+
"devbox",
196+
"template",
197+
"run",
198+
"opengauss",
199+
"--experimental-run-locally",
200+
]

0 commit comments

Comments
 (0)