cli: set needs_user_terminal for all ssh commands
This commit is contained in:
@@ -154,7 +154,7 @@ def show_block_devices(options: BlockDeviceOptions) -> Blockdevices:
|
||||
"PATH,NAME,RM,SIZE,RO,MOUNTPOINTS,TYPE,ID-LINK",
|
||||
],
|
||||
)
|
||||
proc = run_no_stdout(cmd)
|
||||
proc = run_no_stdout(cmd, needs_user_terminal=True)
|
||||
res = proc.stdout.strip()
|
||||
|
||||
blk_info: dict[str, Any] = json.loads(res)
|
||||
|
||||
@@ -194,6 +194,7 @@ def run_no_stdout(
|
||||
log: Log = Log.STDERR,
|
||||
check: bool = True,
|
||||
error_msg: str | None = None,
|
||||
needs_user_terminal: bool = False,
|
||||
) -> CmdOut:
|
||||
"""
|
||||
Like run, but automatically suppresses stdout, if not in DEBUG log level.
|
||||
@@ -204,4 +205,11 @@ def run_no_stdout(
|
||||
if logging.getLogger(__name__.split(".")[0]).isEnabledFor(logging.DEBUG):
|
||||
return run(cmd, env=env, log=log, check=check, error_msg=error_msg)
|
||||
log = Log.NONE
|
||||
return run(cmd, env=env, log=log, check=check, error_msg=error_msg)
|
||||
return run(
|
||||
cmd,
|
||||
env=env,
|
||||
log=log,
|
||||
check=check,
|
||||
error_msg=error_msg,
|
||||
needs_user_terminal=needs_user_terminal,
|
||||
)
|
||||
|
||||
@@ -41,6 +41,7 @@ def upload_secrets(machine: Machine) -> None:
|
||||
],
|
||||
),
|
||||
log=Log.BOTH,
|
||||
needs_user_terminal=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ def generate_machine_hardware_info(opts: HardwareGenerateOptions) -> HardwareRep
|
||||
*config_command,
|
||||
],
|
||||
)
|
||||
out = run(cmd)
|
||||
out = run(cmd, needs_user_terminal=True)
|
||||
if out.returncode != 0:
|
||||
log.error(out)
|
||||
msg = f"Failed to inspect {opts.machine}. Address: {opts.target_host}"
|
||||
|
||||
@@ -121,7 +121,7 @@ def check_machine_online(
|
||||
],
|
||||
)
|
||||
try:
|
||||
proc = run_no_stdout(cmd)
|
||||
proc = run_no_stdout(cmd, needs_user_terminal=True)
|
||||
if proc.returncode != 0:
|
||||
return "Offline"
|
||||
except ClanCmdError:
|
||||
|
||||
@@ -42,6 +42,7 @@ def upload_secrets(machine: Machine) -> None:
|
||||
],
|
||||
),
|
||||
log=Log.BOTH,
|
||||
needs_user_terminal=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user