Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit a3b57dd

Browse files
tomwganemtonivdv
authored andcommitted
Re-use method to find xhyve net ip for vmwarevsphere (#87)
* fix(vmwarevsphere): find nfshost ip address correctly find nfshost ip address in the exact same way as the xhyve driver * fix: DRY up xhyve and vmwarevsphere code
1 parent e09d819 commit a3b57dd

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

docker-machine-nfs.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ lookupMandatoryProperties ()
292292
return
293293
fi
294294

295-
if [ "$prop_machine_driver" = "xhyve" ]; then
295+
if [[ "$prop_machine_driver" =~ (xhyve|vmwarevsphere) ]]; then
296296
prop_network_id="Shared"
297297
prop_nfshost_ip=${prop_use_ip:-"$(ifconfig -m `route get $prop_machine_ip | awk '{if ($1 ~ /interface:/){print $2}}'` | awk 'sub(/inet /,""){print $1}')"}
298298
if [ "" = "${prop_nfshost_ip}" ]; then
299-
echoError "Could not find the xhyve net IP!"; exit 1
299+
echoError "Could not find a route to the ${prop_machine_driver} docker-machine"; exit 1
300300
fi
301301
echoSuccess "OK"
302302
return
@@ -315,19 +315,6 @@ lookupMandatoryProperties ()
315315
return
316316
fi
317317

318-
if [ "$prop_machine_driver" = "vmwarevsphere" ]; then
319-
# Checks the routing table to find the ip address that your machine will use to connect to the docker-machine
320-
machine_ip=$(netstat -rn -f inet | awk -v pattern="^$(route get ${prop_machine_ip} | grep gateway | awk '{print $2}')[^\/]" '$0 ~ pattern {print $2}')
321-
prop_nfshost_ip=${prop_use_ip:-${machine_ip}}
322-
323-
if [ "" = "${prop_nfshost_ip}" ]; then
324-
echoError "Could not find a route to the docker-machine!"; exit 1
325-
fi
326-
327-
echoSuccess "OK"
328-
return
329-
fi
330-
331318
if [ "$prop_machine_driver" != "virtualbox" ]; then
332319
echoError "Unsupported docker-machine driver: $prop_machine_driver"; exit 1
333320
fi

0 commit comments

Comments
 (0)