summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Malchuk <mmalchuk@mirantis.com>2016-08-31 17:18:21 +0300
committerMaksim Malchuk <mmalchuk@mirantis.com>2016-09-01 00:22:11 +0300
commit16c48fc045646140a487efb357b5180ed0e58d3f (patch)
tree3dead84bfea8a147b374ed02b4a05190687e3f78
parent984547cc1f9b5b622d496e07c5df343667f15fba (diff)
Correctly support all NetworkManager versions
This change adds support of the all versions of the nmcli command. Change-Id: Icc5f93d052c451116b23c2922fe18e23e3f72746 Closes-Bug: #1617453 Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
Notes
Notes (review): Code-Review+1: Serhii Ovsianikov <sovsianikov@mirantis.com> Code-Review+1: Kyrylo Galanov <kgalanov@mirantis.com> Code-Review+2: Sergey Kulanov <skulanov@mirantis.com> Workflow+1: Sergey Kulanov <skulanov@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 02 Sep 2016 10:59:56 +0000 Reviewed-on: https://review.openstack.org/363708 Project: openstack/fuel-virtualbox Branch: refs/heads/master
-rwxr-xr-xfunctions/product.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/functions/product.sh b/functions/product.sh
index 68caa1c..1668fe2 100755
--- a/functions/product.sh
+++ b/functions/product.sh
@@ -164,10 +164,18 @@ enable_outbound_network_for_product_vm() {
164 nameserver="$(execute grep '^nameserver' /etc/resolv.conf | egrep -v 'nameserver\s*(127\.|.*:)' | head -3)" 164 nameserver="$(execute grep '^nameserver' /etc/resolv.conf | egrep -v 'nameserver\s*(127\.|.*:)' | head -3)"
165 fi 165 fi
166 if [ -z "$nameserver" ] && execute test -x /usr/bin/nmcli; then 166 if [ -z "$nameserver" ] && execute test -x /usr/bin/nmcli; then
167 #
168 if [ -z "`execute LANG=C nmcli nm help 2>&1 | grep \"Error\"`" ]; then
169 nmcli_status="nm"
170 nmcli_settings="list"
171 else
172 nmcli_status="general"
173 nmcli_settings="show"
174 fi
167 # Get DNS from network manager 175 # Get DNS from network manager
168 if [ -n "`execute LANG=C nmcli nm | grep \"running\s\+connected\"`" ]; then 176 if [ -n "`execute LANG=C nmcli ${nmcli_status} | grep \"\bconnected\"`" ]; then
169 # we should exclude loopback and IPv6 addresses from the nameservers list 177 # we should exclude loopback and IPv6 addresses from the nameservers list
170 nameserver="$(execute nmcli dev list | grep 'IP[46].DNS' | sed -e 's/IP[46]\.DNS\[[0-9]\+\]:\s\+/nameserver /'| grep -v 'nameserver\s*(127\.|.*:)' | head -3)" 178 nameserver="$(execute nmcli device ${nmcli_settings} | grep 'IP[46].DNS' | sed -e 's/IP[46]\.DNS\[[0-9]\+\]:\s\+/nameserver /'| grep -v 'nameserver\s*(127\.|.*:)' | head -3)"
171 fi 179 fi
172 fi 180 fi
173 if [ -z "$nameserver" ]; then 181 if [ -z "$nameserver" ]; then
@@ -327,4 +335,4 @@ ENDOFEXPECT
327 ) 335 )
328 echo "OK" 336 echo "OK"
329 return 0 337 return 0
330} \ No newline at end of file 338}