yandrey321 commented on code in PR #5:
URL: https://github.com/apache/ozone-installer/pull/5#discussion_r2834385856
##########
ozone_installer.py:
##########
@@ -568,203 +574,230 @@ def main(argv: List[str]) -> int:
logger.error("Error: HA requires at least 3 master hosts (to map 3 OMs
and 3 SCMs).")
return 2
- # Resolve download base early for version selection
- dl_url = args.dl_url or (last_cfg.get("dl_url") if last_cfg else None) or
DEFAULTS["dl_url"]
- ozone_version = args.version or (last_cfg.get("ozone_version") if last_cfg
else None)
- if not ozone_version:
- # Try to fetch available versions from dl_url and offer selection
- versions = fetch_available_versions(dl_url or DEFAULTS["dl_url"])
- selected = choose_version_interactive(versions,
DEFAULTS["ozone_version"], yes_mode=yes)
- if selected:
- ozone_version = selected
- else:
- # Fallback prompt if fetch failed
- ozone_version = prompt("Ozone version (e.g., 2.1.0 | local)",
default=DEFAULTS["ozone_version"], yes_mode=yes)
- jdk_major = args.jdk_version if args.jdk_version is not None else
((last_cfg.get("jdk_major") if last_cfg else None))
- if jdk_major is None:
- _jdk_val = prompt("JDK major (option: 17 or 21)",
default=str(DEFAULTS["jdk_major"]), yes_mode=yes)
- try:
- jdk_major = int(str(_jdk_val)) if _jdk_val is not None else
DEFAULTS["jdk_major"]
- except Exception:
- jdk_major = DEFAULTS["jdk_major"]
- install_base = args.install_dir or (last_cfg.get("install_base") if
last_cfg else None) \
- or prompt("Install directory (base directory path to store ozone
binaries, configs and logs)", default=DEFAULTS["install_base"], yes_mode=yes)
- data_base_raw = args.data_dir or (last_cfg.get("data_base") if last_cfg
else None) \
- or prompt("Data directory (base path(s), comma-separated or brace
expansion e.g. /data/ozone{1..3})", default=DEFAULTS["data_base"], yes_mode=yes)
- data_base = parse_data_dirs(data_base_raw) if data_base_raw else
(data_base_raw or DEFAULTS["data_base"])
-
- # Auth (before service user/group)
+ # Auth (needed for all modes: install, stop-only, stop-and-clean)
auth_method = args.auth_method or (last_cfg.get("auth_method") if last_cfg
else None) \
- or prompt("SSH authentication method (option: key or password)",
default="password", yes_mode=yes)
+ or prompt("SSH authentication method (key or password)",
default="password", yes_mode=yes)
if auth_method not in ("key", "password"):
auth_method = "password"
ssh_user = args.ssh_user or (last_cfg.get("ssh_user") if last_cfg else
None) \
or prompt("SSH username", default="root", yes_mode=yes)
- password = args.password or ((last_cfg.get("password") if last_cfg else
None)) # persisted for resume on request
+ password = args.password or (last_cfg.get("password") if last_cfg else
None)
keyfile = args.keyfile or (last_cfg.get("keyfile") if last_cfg else None)
if auth_method == "password" and not password:
password = prompt("SSH password", default="", secret=True,
yes_mode=yes)
if auth_method == "key" and not keyfile:
keyfile = prompt("Path to SSH private key", default=str(Path.home() /
".ssh" / "id_ed25519"), yes_mode=yes)
- # Ensure we don't mix methods
if auth_method == "password":
keyfile = None
elif auth_method == "key":
password = None
- service_user = args.service_user or (last_cfg.get("service_user") if
last_cfg else None) \
- or prompt("Service user name ", default=DEFAULTS["service_user"],
yes_mode=yes)
- service_group = args.service_group or (last_cfg.get("service_group") if
last_cfg else None) \
- or prompt("Service group name", default=DEFAULTS["service_group"],
yes_mode=yes)
- dl_url = args.dl_url or (last_cfg.get("dl_url") if last_cfg else None) or
DEFAULTS["dl_url"]
- start_after_install = (args.start or (last_cfg.get("start_after_install")
if last_cfg else None)
- or DEFAULTS["start_after_install"])
- use_sudo = (args.use_sudo or (last_cfg.get("use_sudo") if last_cfg else
None)
- or DEFAULTS["use_sudo"])
-
- # Local specifics (single path to local build)
- local_path = (getattr(args, "local_path", None) or
(last_cfg.get("local_path") if last_cfg else None))
- local_shared_path = None
- local_oz_dir = None
- if ozone_version and ozone_version.lower() == "local":
- # Accept a direct path to the ozone build dir (relative or absolute)
and validate it.
- # Backward-compat: if only legacy split values were saved previously,
resolve them.
- candidate = None
- if local_path:
- candidate = Path(local_path).expanduser().resolve()
+
+ # Stop modes: gather minimal config, then fall through to common inventory
+ playbook run
+ python_interpreter = None
+ if stop_only:
Review Comment:
I'd recommend moving code to action specific functions/handlers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]