diff --git a/xCAT-genesis-scripts/usr/bin/allowcred.awk b/xCAT-genesis-scripts/usr/bin/allowcred.awk index 341138d3e4..2e1cee75c2 100755 --- a/xCAT-genesis-scripts/usr/bin/allowcred.awk +++ b/xCAT-genesis-scripts/usr/bin/allowcred.awk @@ -1,9 +1,23 @@ #!/usr/bin/awk -f +# +# The Genesis copy of xCAT/postscripts/allowcred.awk. A /inet/ listener on this gawk +# accepts no IPv6 connection, so an IPv6-only node got no credentials during discovery. BEGIN { - listener = "/inet/tcp/300/0/0" + port = ("XCAT_CREDENTIAL_CALLBACK_PORT" in ENVIRON) ? ENVIRON["XCAT_CREDENTIAL_CALLBACK_PORT"] : 300 + if (port !~ /^[0-9]+$/ || port < 1 || port > 65535) { + port = 300 + } + + master = ("MASTER_IP" in ENVIRON) ? ENVIRON["MASTER_IP"] : "" + if (master == "") { + master = ("MASTER" in ENVIRON) ? ENVIRON["MASTER"] : "" + } + if (master ~ /:/) { + listener = "/inet6/tcp/" port "/0/0" + } else { + listener = "/inet/tcp/" port "/0/0" + } quit = "no" - - while (match(quit,"no")) { while ((listener |& getline) > 0) { if (match($0,"CREDOKBYYOU?")) { diff --git a/xCAT-genesis-scripts/usr/bin/updateflag.awk b/xCAT-genesis-scripts/usr/bin/updateflag.awk index 96848f4bb7..397f70b20e 100755 --- a/xCAT-genesis-scripts/usr/bin/updateflag.awk +++ b/xCAT-genesis-scripts/usr/bin/updateflag.awk @@ -1,32 +1,46 @@ #!/usr/bin/awk -f # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# +# The Genesis copy of xCAT/postscripts/updateflag.awk. It writes no file: Genesis has no +# /var/log/xcat directory, rsyslog sends everything to /var/log/xcat.genesis, and gawk is +# fatal when it cannot open a redirect. BEGIN { xcatdhost = ARGV[1] xcatdport = ARGV[2] flag = ARGV[3] - if (!flag) flag = "next" + if (!flag) flag = "next" - ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport + if (xcatdhost ~ /^\[.*\]$/) { + sub(/^\[/, "", xcatdhost) + sub(/\]$/, "", xcatdhost) + } + netfamily = index(xcatdhost, ":") ? "inet6" : "inet" + ns = "/" netfamily "/tcp/0/" xcatdhost "/" xcatdport - while(1) { - if((ns |& getline) > 0) - print $0 | "logger -t xcat -p local4.info" + loop = 0 + while(1) { + if((ns |& getline) > 0) + print $0 | "logger -t xcat -p local4.info" else { print "Retrying flag update" | "logger -t xcat -p local4.info" close(ns) system("sleep 10") + loop = loop + 1 } - if($0 == "ready") - print flag |& ns - if($0 == "done") - break - } + if($0 == "ready") + print flag |& ns + if($0 == "done") + break + if(loop > 10) { + print "flag update failed" | "logger -t xcat -p local4.info" + break + } + } - close(ns) + close(ns) - exit 0 + exit 0 } -