Skip to content

Commit

Permalink
Add search algorithm for host ip with fedora enp* network interfaces e…
Browse files Browse the repository at this point in the history
…clipse-che#4020

Change-Id: I6b65eba02eaab76260d33ffb323fe7413d5ee162
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
  • Loading branch information
benoitf committed Feb 23, 2017
1 parent 2b1175d commit b7dde20
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dockerfiles/ip/src/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ find_network_interface() {
# native mode
if test -z ${NETWORK_IF}; then
for i in $(get_network_interfaces_list); do
if [ ${i:0:3} = eth ] || [ ${i:0:3} = ens ] || [ ${i:0:4} = wlan ] ;then
if [ ${i:0:3} = eth ] || [ ${i:0:3} = enp ] || [ ${i:0:3} = ens ] || [ ${i:0:4} = wlan ] ;then
if has_ip_on_network_interface $i; then
NETWORK_IF=$i
break
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/ip/tests/ip-results/fedora-native.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
192.168.0.209
1 change: 1 addition & 0 deletions dockerfiles/ip/tests/ip-results/fedora-native.interface
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enp2s0
18 changes: 18 additions & 0 deletions dockerfiles/ip/tests/ip-results/fedora-native.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
link/ether 90:e6:ba:52:f3:20 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.209/24 brd 192.168.0.255 scope global dynamic enp2s0
valid_lft 863569sec preferred_lft 863569sec
inet6 fe80::7d9:e299:80c2:e75b/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:57:71:98:fb brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:57ff:fe71:98fb/64 scope link
valid_lft forever preferred_lft forever
1 change: 1 addition & 0 deletions dockerfiles/ip/tests/ip-results/fedora-native.uname
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.4.0-21-generic
4 changes: 4 additions & 0 deletions dockerfiles/ip/tests/library_tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ check_ip_result() {
check_ip_result "ubuntu-native"
}

@test "Get ip based on ip a show interface (fedora/native)" {
check_ip_result "fedora-native"
}

@test "Get ip based on ip a show interface (fedora/multiple-ips)" {
check_ip_result "fedora-multiple-ips"
}
Expand Down

0 comments on commit b7dde20

Please sign in to comment.