Skip to content

Commit

Permalink
Remove trailing dot from FQDN
Browse files Browse the repository at this point in the history
As it is described in #2140, the trailing dot might appear
when starting a container via "weave run".
  • Loading branch information
brb committed Apr 11, 2016
1 parent 28e0b14 commit a4062bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/270_use_name_as_hostname_test.sh
Expand Up @@ -8,7 +8,8 @@ HOSTNAME=$NAME-hostname.$DOMAIN

# Docker inspect hostname + domainname of container $2 on host $1
docker_inspect_fqdn() {
docker_on $1 inspect --format='{{.Config.Hostname}}.{{.Config.Domainname}}' $2
FQDN=$(docker_on $1 inspect --format='{{.Config.Hostname}}.{{.Config.Domainname}}' $2)
echo ${FQDN%.}
}

# Start container with args $2.. and assert fqdn of $1
Expand Down
2 changes: 1 addition & 1 deletion weave
Expand Up @@ -1150,7 +1150,7 @@ etc_hosts_contents() {
shift
NAME=${FQDN%%.*}
HOSTNAMES="$NAME"
[ "$NAME" = "$FQDN" -o "$NAME." = "$FQDN" ] || HOSTNAMES="$FQDN $HOSTNAMES"
[ "$NAME" = "$FQDN" -o "$NAME." = "$FQDN" ] || HOSTNAMES="${FQDN%.} $HOSTNAMES"

echo "# created by Weave - BEGIN"
echo "# container hostname"
Expand Down

0 comments on commit a4062bd

Please sign in to comment.