diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2019-03-22 21:03:54 +1300 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2019-04-03 21:41:56 +0000 |
commit | 40122e7c54a2d57294d6ac27932c9b012f9fb9fd (patch) | |
tree | e3f8677ca6962ae1083e5ca029f6f41e8b5c03db | |
parent | 75784f94b1411a325ab3bdff4c71d2e5aa2abc2b (diff) | |
download | trove-40122e7c54a2d57294d6ac27932c9b012f9fb9fd.tar.gz |
Fix the way to get localhost IP in devstack
In Ubuntu Bionic, the following command returns "uid" so that the
guest-agent service will fail because of invalid IP address.
$ ip route get 8.8.8.8 | head -1 | cut -d' ' -f8
uid
$ ip route get 8.8.8.8 | head -1
8.8.8.8 via 10.0.17.1 dev ens3 src 10.0.17.131 uid 0
In Ubuntu Xenial:
$ ip route get 8.8.8.8 | head -1 | cut -d' ' -f8
10.0.17.132
$ ip route get 8.8.8.8 | head -1
8.8.8.8 via 192.168.192.1 dev eth0 src 10.0.17.132
Change-Id: Iae24686fa65603b7d22b09da99b7590e4e117454
(cherry picked from commit 4a85d9b77ff475e45ea80c80b2a276d3fff13727)
-rw-r--r-- | devstack/plugin.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh index c9d42e76..8721f546 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -577,7 +577,7 @@ function _setup_minimal_image { ##### - we assume tripleo elements and all other elements have been downloaded echo "Exporting image-related environmental variables" - PRIMARY_IP=$(ip route get 8.8.8.8 | head -1 | cut -d' ' -f8) + PRIMARY_IP=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}') export CONTROLLER_IP=${CONTROLLER_IP:-$PRIMARY_IP} export HOST_USERNAME=${HOST_USERNAME:-'stack'} export HOST_SCP_USERNAME=${HOST_SCP_USERNAME:-'stack'} |