Change default DMaaP hostname 05/32305/1
authorLusheng Ji <lji@research.att.com>
Tue, 20 Feb 2018 19:42:49 +0000 (14:42 -0500)
committerLusheng Ji <lji@research.att.com>
Tue, 20 Feb 2018 19:42:56 +0000 (14:42 -0500)
The changes are for the purpose of allowing DMAAPHOST environmental
variable to accept either hostname and IP address.  If it is IP
address, the resolution for default dmaap hostname is written to
/etc/hosts; if hostname,an alias is created in /etc/host.aliases
for the default dmaap hostname.
(for the hostname aliasing to work, chnage default dmaap hostname
to onap-dmaap, no domain).

Change-Id: I58583cc5b678a29b54d8baecbd0b7bec621f7c8f
Signed-off-by: Lusheng Ji <lji@research.att.com>
Issue-ID: DCAEGEN2-235

Dockerfile
etc/DmaapConfig.json
src/main/scripts/docker-entry.sh

index c7f7c2e..37afd65 100644 (file)
@@ -7,6 +7,7 @@ WORKDIR /opt/app/VESCollector
 
 ENV HOME /opt/app/VESCollector
 ENV JAVA_HOME /usr
+ENV HOSTALIASES /etc/host.aliases
 
 RUN apt-get update && apt-get install -y \
         curl \
index f144b38..529f314 100644 (file)
@@ -6,7 +6,7 @@
                        "class": "HpCambriaOutputStream",\r
                        "stripHpId": "true",\r
                        "type": "out",\r
-                       "cambria.hosts": "onap.dmaap.org"\r
+                       "cambria.hosts": "onap-dmaap"\r
                },\r
                {\r
                        "name": "ves_fault",\r
@@ -14,7 +14,7 @@
                        "class": "HpCambriaOutputStream",\r
                        "stripHpId": "true",\r
                        "type": "out",\r
-                       "cambria.hosts": "onap.dmaap.org"\r
+                       "cambria.hosts": "onap-dmaap"\r
                },\r
                {\r
                        "name": "ves_heartbeat",\r
@@ -22,7 +22,7 @@
                        "class": "HpCambriaOutputStream",\r
                        "stripHpId": "true",\r
                        "type": "out",\r
-                       "cambria.hosts": "onap.dmaap.org"\r
+                       "cambria.hosts": "onap-dmaap"\r
                }\r
        ]\r
 }\r
index 26dcb89..3b73005 100644 (file)
@@ -24,7 +24,11 @@ if [ ! -z "$COLLECTOR_IP" ]; then
 fi
 
 if [ ! -z "$DMAAPHOST" ]; then
-        echo $DMAAPHOST  onap.dmaap.org >> /etc/hosts
+        if [ -z "$(echo $DMAAPHOST | sed -e 's/[0-9\.]//g')" ]; then 
+                echo "$DMAAPHOST  onap-dmaap" >> /etc/hosts
+        else
+                echo "onap-dmaap $DMAAPHOST" >> /etc/host.aliases
+        fi
 else
        echo "DMAAPHOST ENV NOT SET!! PUBLISH WILL NOT BE SUPPORTED"
 fi