Fix anaconda host IP caching to handle port number in URL

A hook was added to run before Anaconda installer to lookup the IP
address of the boot server and write it to /etc/hosts, in order to avoid
DNS queries during the installation. However, the regex to grab the
server from the kickstart URL did not handle the case where a port was
specified, ie http://bootserver:8080/..., and the hook would hang trying
to ping an invalid name.

This update extends the regex in the hook to ignore the port number, if
present.

Change-Id: Idec2219f0be55f08e7fd648a91a32428178715f6
Story: 2002856
Task: 22805
Signed-off-by: Jack Ding <jack.ding@windriver.com>
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Don Penney 2018-06-12 10:23:06 -04:00 committed by Scott Little
parent ac1f65639a
commit 968fb132a9
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ index 0000000..e3f79a4
+cat /proc/cmdline | grep -q 'inst\.ks=http://'
+if [ $? -eq 0 ]
+then
+ server=$(cat /proc/cmdline | sed -r 's#.*inst\.ks=http://([^/]*)/.*#\1#')
+ server=$(cat /proc/cmdline | sed -r 's#.*inst\.ks=http://([^/:]*)(:[^/]*)?/.*#\1#')
+ if [ -n "$server" ]
+ then
+ echo "Testing connectivity to server: $server"