weave dns commands do not behave as expected (fail silently, do nothing, etc.) #2858
Description
Steps to reproduce
1) using weave expose
a) invalid FQDN
weave dns-add 10.32.0.1 -h foo
fails as foo
is not a valid FQDN, but does so silently:
host1 $ weave expose
10.32.0.1
host1 $ weave dns-add 10.32.0.1 -h foo
# <<< Would have expected an error message here!
host1 $ echo $?
0
# <<< Would have expected 1 as the status code here!
host1 $ weave status dns
Admittedly docker logs
says:
INFO: [nameserver 8e:6b:f4:68:ff:4d] Ignoring registration foo. 10.32.0.1 weave:expose (not a subdomain of weave.local.)
but this is easy to miss for the end user, and Weave Net should probably fail much ealier.
b) weave dns-remove
on non-owner peer
weave dns-remove 10.32.0.1 -h foo.weave.local
fails on host2
, as this peer does not own the DNS record (unlike host1
), but does so silently:
host1 $ weave expose
10.32.0.1
host1 $ weave dns-add 10.32.0.1 -h foo.weave.local
host1 $ echo $?
0
host1 $ weave status dns
foo 10.32.0.1 weave:extern 8e:6b:f4:68:ff:4d
host2 $ weave status dns
foo 10.32.0.1 weave:extern 8e:6b:f4:68:ff:4d
host2 $ weave dns-remove 10.32.0.1 -h foo.weave.local
# <<< Would have expected an error message here!
host2 $ echo $?
0
# <<< Would have expected 1 as the status code here!
host2 $ weave status dns
foo 10.32.0.1 weave:extern 8e:6b:f4:68:ff:4d
host1 $ weave status dns
foo 10.32.0.1 weave:extern 8e:6b:f4:68:ff:4d
host1 $ weave dns-remove 10.32.0.1 -h foo.weave.local
host1 $ echo $?
0
host1 $ weave status dns
host2 $ weave status dns
2) using weave expose -h <fqdn>
a) invalid FQDN
weave expose -h foo
fails as foo
is not a valid FQDN, but does so silently:
host1 $ weave expose -h foo
10.32.0.1
# <<< Would have expected an error message here!
host1 $ echo $?
0
# <<< Would have expected 1 as the status code here!
host1 $ weave status dns
Admittedly docker logs
says:
INFO: [nameserver 8e:6b:f4:68:ff:4d] Ignoring registration foo. 10.32.0.1 weave:expose (not a subdomain of weave.local.)
but this is easy to miss for the end user, and Weave Net should probably fail much ealier.
b) weave dns-remove
does not do anything
host1 $ weave expose -h foo.weave.local
10.32.0.1
host1 $ echo $?
0
host1 $ weave status dns
foo 10.32.0.1 weave:expose 8e:6b:f4:68:ff:4d
host2 $ weave status dns
foo 10.32.0.1 weave:expose 8e:6b:f4:68:ff:4d
host2 $ weave dns-remove 10.32.0.1 -h foo.weave.local
# <<< Would have expected an error message here!
host2 $ echo $?
0
# <<< Would have expected 1 as the status code here!
host2 $ weave status dns
foo 10.32.0.1 weave:expose 8e:6b:f4:68:ff:4d
host1 $ weave dns-remove 10.32.0.1 -h foo.weave.local
host1 $ echo $?
0
host1 $ weave status dns
foo 10.32.0.1 weave:expose 8e:6b:f4:68:ff:4d
# <<< Would have expected the DNS entry to be removed!
host1 $ weave hide -h foo.weave.local
10.32.0.1
host1 $ weave status dns
host2 $ weave status dns
docker logs
says:
### host1 $ weave dns-add 10.32.0.1 -h foo.weave.local
INFO: [nameserver 8e:6b:f4:68:ff:4d] adding entry for weave:expose: foo.weave.local. -> 10.32.0.1
### host1 $ weave dns-remove 10.32.0.1 -h foo.weave.local
INFO: Expired MAC 7e:07:75:8c:ca:9b at 7e:07:75:8c:ca:9b(host2)
INFO: [nameserver 8e:6b:f4:68:ff:4d] tombstoning hostname=foo.weave.local., container=weave:extern, ip=10.32.0.1
INFO: [nameserver 8e:6b:f4:68:ff:4d] tombstoning entry foo.weave.local. -> 10.32.0.1
### host1 $ weave hide -h foo.weave.local
INFO: [nameserver 8e:6b:f4:68:ff:4d] tombstoning hostname=*, container=weave:expose, ip=10.32.0.1
INFO: [nameserver 8e:6b:f4:68:ff:4d] tombstoning entry foo.weave.local. -> 10.32.0.1
INFO: [nameserver 8e:6b:f4:68:ff:4d] tombstoning entry host1.weave.local. -> 10.32.0.1
3) Using a container
a) invalid FQDN
weave expose -h foo
fails as foo
is not a valid FQDN, but does so silently:
host1 $ docker run -d nginx
700c334e950b
host1 $ weave dns-add 700c334e950b -h foo
# <<< Would have expected an error message here!
host1 $ echo $?
0
# <<< Would have expected 1 as the status code here!
host1 $ weave status dns
Admittedly docker logs
says:
INFO: [nameserver 8e:6b:f4:68:ff:4d] Ignoring registration foo. 10.32.0.1 700c334e950bcc312872d5489de86c399e62cc0979f58d733aff8bbbb1366e51 (not a subdomain of weave.local.)
but this is easy to miss for the end user, and Weave Net should probably fail much ealier.
b) weave dns-remove
fails, but maybe for the wrong reasons?
In this scenario, the command fail, as expected, but potentially for the wrong reason of not having the container running locally. Indeed, given Weave Net is said to be peer-to-peer, wouldn't it be reasonable, from an end-user's perspective, to be able to run such commands on any peer?
host1 $ docker run -d nginx
7efdaacbef5b
host1 $ weave dns-add 7efdaacbef5b -h foo.weave.local
host1 $ weave status dns
foo 10.32.0.2 7efdaacbef5b 8e:6b:f4:68:ff:4d
host2 $ weave status dns
foo 10.32.0.2 7efdaacbef5b 8e:6b:f4:68:ff:4d
host2 $ weave dns-remove 7efdaacbef5b -h foo.weave.local
7efdaacbef5b container is not present. Have you launched it?
host2 $ echo "$?"
1
As discussed internally, this may not be trivial to implement in Mesh.
See also
- User's question: https://groups.google.com/a/weave.works/d/topic/weave-users/vvXFjTVTGIc/discussion
- Internal discussion: https://weaveworks.slack.com/archives/C0DNGPKLY/p1490004882751610 (and subsequent questions/answers over the rest of the day)