mirror of https://github.com/apache/cloudstack.git
utils: use iproute to get default network interface (#3704)
Use iproute to get default network interface This uses `ip route` than `route` without an explicit path (/bin, /sbin etc.) to query the default network interface on the system. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
a65a931e92
commit
e93f6bf3c2
|
|
@ -15,7 +15,7 @@ Description: A common package which contains files which are shared by several C
|
|||
|
||||
Package: cloudstack-management
|
||||
Architecture: all
|
||||
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), sudo, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, file, lsb-release, init-system-helpers (>= 1.14~)
|
||||
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), sudo, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, file, gawk, iproute2, lsb-release, init-system-helpers (>= 1.14~)
|
||||
Conflicts: cloud-server, cloud-client, cloud-client-ui
|
||||
Description: CloudStack server library
|
||||
The CloudStack management server
|
||||
|
|
|
|||
|
|
@ -58,12 +58,14 @@ Requires: java-1.8.0-openjdk
|
|||
Requires: python
|
||||
Requires: python3
|
||||
Requires: bash
|
||||
Requires: gawk
|
||||
Requires: bzip2
|
||||
Requires: gzip
|
||||
Requires: unzip
|
||||
Requires: /sbin/mount.nfs
|
||||
Requires: openssh-clients
|
||||
Requires: nfs-utils
|
||||
Requires: iproute
|
||||
Requires: wget
|
||||
Requires: mysql
|
||||
Requires: mysql-connector-java
|
||||
|
|
|
|||
|
|
@ -268,19 +268,7 @@ public class NetUtils {
|
|||
final String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'");
|
||||
return defDev;
|
||||
}
|
||||
final String defaultRoute = Script.runSimpleBashScript("/sbin/route | grep default");
|
||||
|
||||
if (defaultRoute == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String[] defaultRouteList = defaultRoute.split("\\s+");
|
||||
|
||||
if (defaultRouteList.length != 8) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return defaultRouteList[7];
|
||||
return Script.runSimpleBashScript("ip route show default 0.0.0.0/0 | head -1 | awk '{print $5}'");
|
||||
}
|
||||
|
||||
public static String getLocalIPString() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue