diff --git a/cmdeploy/src/cmdeploy/remote/rdns.py b/cmdeploy/src/cmdeploy/remote/rdns.py index ce66c46d..7340a777 100644 --- a/cmdeploy/src/cmdeploy/remote/rdns.py +++ b/cmdeploy/src/cmdeploy/remote/rdns.py @@ -11,15 +11,13 @@ All functions of this module """ import re -from pprint import pprint + from .rshell import CalledProcessError, shell, log_progress def perform_initial_checks(mail_domain, pre_command=""): """Collecting initial DNS settings.""" assert mail_domain - pprint("rdns.perform_initial_checks: " + shell.__module__) - if not shell("dig", fail_ok=True, print=log_progress): shell("apt-get update && apt-get install -y dnsutils", print=log_progress) A = query_dns("A", mail_domain) diff --git a/cmdeploy/src/cmdeploy/remote/rshell.py b/cmdeploy/src/cmdeploy/remote/rshell.py index 84475816..f8166816 100644 --- a/cmdeploy/src/cmdeploy/remote/rshell.py +++ b/cmdeploy/src/cmdeploy/remote/rshell.py @@ -1,5 +1,5 @@ import sys -from pprint import pprint + from subprocess import DEVNULL, CalledProcessError, check_output @@ -9,7 +9,6 @@ def log_progress(data): def shell(command, fail_ok=False, print=print): - pprint("test_cmdeploy: " + shell.__module__) print(f"$ {command}") args = dict(shell=True) if fail_ok: diff --git a/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py b/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py index 6f9a2cc7..6e87b4ea 100644 --- a/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py +++ b/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py @@ -5,8 +5,6 @@ import pytest from cmdeploy.cmdeploy import get_parser, main from cmdeploy.www import get_paths -import cmdeploy.remote.rshell -import cmdeploy.dns @pytest.fixture(autouse=True) @@ -61,27 +59,3 @@ def test_www_folder(example_config, tmp_path): assert www_path == tmp_path assert src_dir == src_path assert build_dir == tmp_path.joinpath("build") - - -def test_dns_when_ssh_docker(monkeypatch): - commands = [] - - def shell(command, fail_ok=None, print=None): - assert command == False - commands.append(command) - - # mock shell function to add called commands to a global list - monkeypatch.setattr( - cmdeploy.remote.rshell, shell.__name__, shell - ) # still doesn't get called in get_initial_remote_data :( - print("test_cmdeploy: " + shell.__module__) - # run cmdeploy dns with --ssh-host - # @docker - cmdeploy.dns.get_initial_remote_data("@docker", "chatmail.example.org") - for cmd in commands: - print(cmd) - # localhost - # @local - # without --ssh-host - # check which commands were called - assert False