cls_cmd: printed commands are debug

This commit is contained in:
Robert Schmidt
2025-03-19 14:57:14 +01:00
parent 7f55a11045
commit c3e9e62f71
+4 -4
View File
@@ -124,12 +124,12 @@ class LocalCmd(Cmd):
ret.args += f" &> {redirect}" ret.args += f" &> {redirect}"
ret.stdout = "" ret.stdout = ""
if not silent: if not silent:
logging.info(f"local> {ret.args}") logging.debug(f"local> {ret.args}")
return ret return ret
def run(self, line, timeout=300, silent=False, reportNonZero=True): def run(self, line, timeout=300, silent=False, reportNonZero=True):
if not silent: if not silent:
logging.info(f"local> {line}") logging.debug(f"local> {line}")
try: try:
if line.strip().endswith('&'): if line.strip().endswith('&'):
# if we wait for stdout, subprocess does not return before the end of the command # if we wait for stdout, subprocess does not return before the end of the command
@@ -244,7 +244,7 @@ class RemoteCmd(Cmd):
p = parameters if parameters else "" p = parameters if parameters else ""
r = f"> {redirect}" if redirect else "" r = f"> {redirect}" if redirect else ""
if not silent: if not silent:
logging.info(f"local> ssh {host} bash -s {p} < {path} {r} # {path} from localhost") logging.debug(f"local> ssh {host} bash -s {p} < {path} {r} # {path} from localhost")
client = RemoteCmd._ssh_init() client = RemoteCmd._ssh_init()
cfg = RemoteCmd._lookup_ssh_config(host) cfg = RemoteCmd._lookup_ssh_config(host)
client.connect(**cfg) client.connect(**cfg)
@@ -264,7 +264,7 @@ class RemoteCmd(Cmd):
def run(self, line, timeout=300, silent=False, reportNonZero=True): def run(self, line, timeout=300, silent=False, reportNonZero=True):
if not silent: if not silent:
logging.info(f"ssh[{self.hostname}]> {line}") logging.debug(f"ssh[{self.hostname}]> {line}")
if self.cwd: if self.cwd:
line = f"cd {self.cwd} && {line}" line = f"cd {self.cwd} && {line}"
try: try: