Description of problem: The validation of mongo replicant fails but because the parsing is incorrect [root@acme001 ~]# grep "MONGO_HOST" /etc/openshift/broker.conf # Eg: MONGO_HOST_PORT="<host1:port1>,<host2:port2>..." #MONGO_HOST_PORT="localhost:27017" MONGO_HOST_PORT="acme001.acme.org:27017,acme002.acme.org:27017" Because of the quotes the host and port settings do not remove the " so the test fails timeout 1 bash -c "cat </dev/null > /dev/tcp/$host/$port" &> /dev/null By changing /usr/sbin/oo-accept-node from host=$(echo $mongo_replicant | cut -d: -f1) port=$(echo $mongo_replicant | cut -d: -f2) to host=$(echo $mongo_replicant | cut -d: -f1 | tr -d '"') port=$(echo $mongo_replicant | cut -d: -f2 | tr -d '"') And the the test passes as the host/port don't contain any quotes Version-Release number of selected component (if applicable): openshift-origin-broker-util-1.36.2.2-1.el6op.noarch
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/a9bcb953f3ec4d822b561e7fc22f4ddba5aa40c1 Bug 1305688 - oo-accept-broker incorrectly parses MONGO_HOST_PORT The validation of mongo replicant fails as the code in oo-accept-broker that is responsible to parse MONGO_HOST_PORT is not working correctly as it fails to remove unwanted quote characters in the variable. This commit fixes the code that is parsing the MONGO_HOST_PORT to remove the quote characters before performing the task. As a result, individual ports and hosts from MONGO_HOST_PORT are now parsed correctly. Bug 1305688 Link <https://bugzilla.redhat.com/show_bug.cgi?id=1305688> Signed-off-by: Vu Dinh <vdinh>
Verified this bug with openshift-origin-broker-util-1.37.5.2-1.el6op.noarch, and PASS. # grep "MONGO_HOST" /etc/openshift/broker.conf # Eg: MONGO_HOST_PORT="<host1:port1>,<host2:port2>..." MONGO_HOST_PORT="localhost:27017" # oo-accept-broker -v <--snip--> INFO: checking Mongo host connectivity INFO: Connected to Mongo host: "localhost:27017" <--snip--> PASS
Actually the PR is not landed into OSE puddle. # rpm -qf /usr/sbin/oo-accept-broker openshift-origin-broker-util-1.37.5.2-1.el6op.noarch # oo-accept-broker + verbose 'checking Mongo host connectivity' + '[' -n '' ']' ++ grep -e '^MONGO_HOST_PORT=' /etc/openshift/broker.conf ++ cut -d= -f2 + MONGO_HOST='"192.168.0.143:27017"' + [[ "192.168.0.143:27017" == *,* ]] ++ echo '"192.168.0.143:27017"' ++ cut -d: -f1 + host='"192.168.0.143' ++ echo '"192.168.0.143:27017"' ++ cut -d: -f2 + port='27017"' + timeout 1 bash -c 'cat </dev/null > /dev/tcp/"192.168.0.143/27017"' + '[' 0 '!=' 0 ']' + verbose 'Connected to Mongo host: "192.168.0.143:27017"' + '[' -n '' ']' + set +x PASS Interestingly, when I run testing using "localhost", no any error is reported in comment6, so pls ignore comment 6. After I modify "localhost" to "192.168.0.143", the issue is reproduced.
QE, Sorry for the confusion earlier, this bug got put on the errata a bit too soon. Can we retest using the latest puddle and the instructions from comment #5? Thank you. Puddle: http://etherpad.corp.redhat.com/puddle-2-2-2016-02-19
Verified this bug with openshift-origin-broker-util-1.37.5.3-1.el6op.noarch, and PASS. # grep "MONGO_HOST" /etc/openshift/broker.conf # Eg: MONGO_HOST_PORT="<host1:port1>,<host2:port2>..." MONGO_HOST_PORT="192.168.0.143:27017,localhost:27017" # oo-accept-broker + verbose 'checking Mongo host connectivity' + '[' -n '' ']' ++ grep -e '^MONGO_HOST_PORT=' /etc/openshift/broker.conf ++ cut -d= -f2 + MONGO_HOST='"192.168.0.143:27017,localhost:27017"' + [[ "192.168.0.143:27017,localhost:27017" == *,* ]] + unreachable_count=0 + replica_count=0 ++ echo '"192.168.0.143:27017,localhost:27017"' ++ sed 's/,/ /g' + for mongo_replicant in '$(echo $MONGO_HOST | sed s/,/\ /g)' + (( replica_count++ )) ++ echo '"192.168.0.143:27017' ++ tr -d ''\''"' ++ cut -d: -f1 + host=192.168.0.143 ++ echo '"192.168.0.143:27017' ++ tr -d ''\''"' ++ cut -d: -f2 + port=27017 + timeout 1 bash -c 'cat </dev/null > /dev/tcp/192.168.0.143/27017' + '[' 0 '!=' 0 ']' + verbose 'Connected to Mongo replicant: "192.168.0.143:27017' + '[' -n '' ']' + for mongo_replicant in '$(echo $MONGO_HOST | sed s/,/\ /g)' + (( replica_count++ )) ++ cut -d: -f1 ++ tr -d ''\''"' ++ echo 'localhost:27017"' + host=localhost ++ echo 'localhost:27017"' ++ tr -d ''\''"' ++ cut -d: -f2 + port=27017 + timeout 1 bash -c 'cat </dev/null > /dev/tcp/localhost/27017' + '[' 0 '!=' 0 ']' + verbose 'Connected to Mongo replicant: localhost:27017"' + '[' -n '' ']' + '[' 0 == 2 ']' + verbose 'At least one Mongo replicant is listening on the specified host and port.' + '[' -n '' ']' + set +x PASS
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-0489.html