Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DNS: always show recommended DNS records #463

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-and-deploy-ipv4only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ jobs:
run: CHATMAIL_DOMAIN2=nine.testrun.org cmdeploy test --slow

- name: cmdeploy dns
run: cmdeploy dns -v --all
run: cmdeploy dns -v

2 changes: 1 addition & 1 deletion .github/workflows/test-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ jobs:
run: CHATMAIL_DOMAIN2=nine.testrun.org cmdeploy test --slow

- name: cmdeploy dns
run: cmdeploy dns -v --all
run: cmdeploy dns -v

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

## 1.5.0 2024-12-20

- cmdeploy dns: always show recommended DNS records
([#463](https://github.com/deltachat/chatmail/pull/463))

- add `--all` to `cmdeploy dns`
([#462](https://github.com/deltachat/chatmail/pull/462))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ scripts/cmdeploy status
To display and check all recommended DNS records:

```
scripts/cmdeploy dns --all
scripts/cmdeploy dns
```

To test whether your chatmail service is working correctly:
Expand Down
8 changes: 1 addition & 7 deletions cmdeploy/src/cmdeploy/cmdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ def dns_cmd_options(parser):
default=None,
help="write out a zonefile",
)
parser.add_argument(
"--all",
dest="all",
action="store_true",
help="check both required and recommended DNS records"
)


def dns_cmd(args, out):
Expand All @@ -137,7 +131,7 @@ def dns_cmd(args, out):
return 0

retcode = dns.check_full_zone(
sshexec, remote_data=remote_data, zonefile=zonefile, out=out, all=args.all
sshexec, remote_data=remote_data, zonefile=zonefile, out=out
)
return retcode

Expand Down
6 changes: 2 additions & 4 deletions cmdeploy/src/cmdeploy/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_filled_zone_file(remote_data):
return zonefile


def check_full_zone(sshexec, remote_data, out, zonefile, all) -> int:
def check_full_zone(sshexec, remote_data, out, zonefile) -> int:
"""Check existing DNS records, optionally write them to zone file
and return (exitcode, remote_data) tuple."""

Expand All @@ -56,12 +56,10 @@ def check_full_zone(sshexec, remote_data, out, zonefile, all) -> int:
out(line)
out("")
returncode = 1
if recommended_diff and (all or not required_diff):
if recommended_diff:
out("WARNING: these recommended DNS entries are not set:\n")
for line in recommended_diff:
out(line)
if all:
returncode = 1

if not (recommended_diff or required_diff):
out.green("Great! All your DNS entries are verified and correct.")
Expand Down
4 changes: 2 additions & 2 deletions cmdeploy/src/cmdeploy/tests/test_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_check_zonefile_output_required_fine(self, cm_data, mockdns_base, mockou
parse_zonefile_into_dict(zonefile_mocked, mockdns_base, only_required=True)
mssh = MockSSHExec()
mockdns_base["mail_domain"] = "some.domain"
res = check_full_zone(mssh, mockdns_base, out=mockout, zonefile=zonefile, all=False)
res = check_full_zone(mssh, mockdns_base, out=mockout, zonefile=zonefile)
assert res == 0
assert "WARNING" in mockout.captured_plain[0]
assert len(mockout.captured_plain) == 9
Expand All @@ -120,7 +120,7 @@ def test_check_zonefile_output_full(self, cm_data, mockdns_base, mockout):
parse_zonefile_into_dict(zonefile, mockdns_base)
mssh = MockSSHExec()
mockdns_base["mail_domain"] = "some.domain"
res = check_full_zone(mssh, mockdns_base, out=mockout, zonefile=zonefile, all=True)
res = check_full_zone(mssh, mockdns_base, out=mockout, zonefile=zonefile)
assert res == 0
assert not mockout.captured_red
assert "correct" in mockout.captured_green[0]
Expand Down
Loading