Skip to content

Commit fe1d56e

Browse files
committed
cmdeploy: call LocalExec directly, not .logged()
1 parent a238e1d commit fe1d56e

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

cmdeploy/src/cmdeploy/cmdeploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def status_cmd(args, out):
192192
else:
193193
out.red("no privacy settings")
194194

195-
for line in sshexec.logged(remote.rshell.get_systemd_running, {}):
195+
for line in sshexec(remote.rshell.get_systemd_running):
196196
print(line)
197197

198198

cmdeploy/src/cmdeploy/sshexec.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def __init__(self, verbose=False, docker=False):
8989
self.verbose = verbose
9090
self.docker = docker
9191

92+
def __call__(self, call, kwargs=None, log_callback=None):
93+
if kwargs is None:
94+
kwargs = {}
95+
return call(**kwargs)
96+
9297
def logged(self, call, kwargs: dict):
9398
where = "locally"
9499
if self.docker:

cmdeploy/src/cmdeploy/tests/online/test_1_basic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ def sshexec(self, sshdomain):
1616
return get_sshexec(sshdomain)
1717

1818
def test_ls(self, sshexec):
19-
out = sshexec.logged(call=remote.rdns.shell, kwargs=dict(command="ls"))
20-
out2 = sshexec.logged(call=remote.rdns.shell, kwargs=dict(command="ls"))
19+
out = sshexec(call=remote.rdns.shell, kwargs=dict(command="ls"))
20+
out2 = sshexec(call=remote.rdns.shell, kwargs=dict(command="ls"))
2121
assert out == out2
2222

2323
def test_perform_initial(self, sshexec, maildomain):
24-
res = sshexec.logged(
24+
res = sshexec(
2525
remote.rdns.perform_initial_checks, kwargs=dict(mail_domain=maildomain)
2626
)
2727
assert res["A"] or res["AAAA"]
@@ -61,7 +61,7 @@ def test_exception(self, sshexec, capsys):
6161
def test_opendkim_restarted(self, sshexec):
6262
"""check that opendkim is not running for longer than a day."""
6363
cmd = "systemctl show opendkim --timestamp=utc --property=ActiveEnterTimestamp"
64-
out = sshexec.logged(call=remote.rshell.shell, kwargs=dict(command=cmd))
64+
out = sshexec(call=remote.rshell.shell, kwargs=dict(command=cmd))
6565
datestring = out.split("=")[1]
6666
since_date = datetime.datetime.strptime(datestring, "%a %Y-%m-%d %H:%M:%S %Z")
6767
now = datetime.datetime.now(since_date.tzinfo)

0 commit comments

Comments
 (0)