-
Bug
-
Resolution: Done
-
Medium
-
Istanbul Release
-
None
Issue may be present in 5gbulkpm usecase. Happens when you for example delete DFC pod for it to redeploy. (Not verified but would probably also happen if PM-Mapper was deployed before DFC)
Bug happens in envsubst
- args: - -c - | if [ -d /opt/app/config/cache ]; then cd /opt/app/config/cache for file in $(ls feed*); do NUM=$(echo "$file" | sed 's/feedConfig-\([0-9]\+\)-resp.json/\1/') export DR_LOG_URL_"$NUM"="$(grep -o '"logURL":"[^"]*' "$file" | cut -d '"' -f4)" export DR_FILES_PUBLISHER_URL_"$NUM"="$(grep -o '"publishURL":"[^"]*' "$file" | cut -d '"' -f4)" done for file in $(ls drpub*); do NUM=$(echo "$file" | sed 's/drpubConfig-\([0-9]\+\)-resp.json/\1/') export DR_USERNAME_"$NUM"="$(grep -o '"username":"[^"]*' "$file" | cut -d '"' -f4)" export DR_PASSWORD_"$NUM"="$(grep -o '"userpwd":"[^"]*' "$file" | cut -d '"' -f4)" export DR_FILES_PUBLISHER_ID_"$NUM"="$(grep -o '"pubId":"[^"]*' "$file" | cut -d '"' -f4)" done for file in $(ls drsub*); do NUM=$(echo "$file" | sed 's/drsubConfig-\([0-9]\+\)-resp.json/\1/') export DR_FILES_SUBSCRIBER_ID_"$NUM"="$(grep -o '"subId":"[^"]*' "$file" | cut -d '"' -f4)" done for file in $(ls topics*); do NUM=$(echo "$file" | sed 's/topicsConfig-\([0-9]\+\)-resp.json/\1/') export MR_FILES_PUBLISHER_CLIENT_ID_"$NUM"="$(grep -o '"mrClientId":"[^"]*' "$file" | cut -d '"' -f4)" done else echo "No Response logged for Dmaap BusController Http POST Request..!" fi cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done command: - /bin/sh
The line causing issues:
export DR_LOG_URL_"$NUM"="$(grep -o '"logURL":"[^"]*' "$file" | cut -d '"' -f4)"
Example feedConfig file content if subs/pubs are present:
{ "lastMod": 1631019212314, "status": "VALID", "feedId": "1", "feedName": "bulk_pm_feed", "feedVersion": "0", "feedDescription": "DFC Feed Creation", "owner": "dcaecm", "asprClassification": "unclassified", "publishURL": "https://dmaap-dr-prov/publish/1", "subscribeURL": "https://dmaap-dr-prov/subscribe/1", "suspended": false, "logURL": "https://dmaap-dr-prov/feedlog/1", "formatUuid": null, "pubs": [ { "lastMod": 1631019212309, "status": "VALID", "dcaeLocationName": "loc00", "username": "tmp_bljs193nlksy5by", "userpwd": "x5fu57bs8xgfwfi", "feedId": "1", "pubId": "1.3ce2v", "feedName": null, "feedVersion": null, "statusValid": true } ], "subs": [ { "lastMod": 1631012790478, "status": "VALID", "dcaeLocationName": "loc00", "username": "username", "userpwd": "password", "feedId": "1", "deliveryURL": "https://dcae-pm-mapper:8443/delivery", "logURL": "https://dmaap-dr-prov/sublog/1", "subId": "1", "use100": false, "suspended": false, "owner": "DGL", "guaranteedDelivery": false, "guaranteedSequence": false, "privilegedSubscriber": true, "decompress": true, "feedName": null, "feedVersion": null, "statusValid": true } ], "bytes": "eyJuYW1lIjogImJ1bGtfcG1fZmVlZCIsICJ2ZXJzaW9uIjogIjAiLCAiZGVzY3JpcHRpb24iOiAiREZDIEZlZWQgQ3JlYXRpb24iLCAic3VzcGVuZCI6IGZhbHNlLCAiYXV0aG9yaXphdGlvbiI6IHsgImNsYXNzaWZpY2F0aW9uIjogInVuY2xhc3NpZmllZCIsICJlbmRwb2ludF9hZGRycyI6IFtdLCJlbmRwb2ludF9pZHMiOiBbCXsiaWQiOiAidG1wX2JsanMxOTNubGtzeTVieSIsInBhc3N3b3JkIjogIng1ZnU1N2JzOHhnZndmaSJ9CSx7ImlkIjogInRtcF9haXJ6dGxzem1iczR5ZHoiLCJwYXNzd29yZCI6ICJiZ2VtcGd2ZDh4ZWhtajUifQkseyJpZCI6ICJ0bXBfOXY2MmIycjR5ZGQweW1oIiwicGFzc3dvcmQiOiAicGpiMnNzN2kyamJuaWl5In0JLHsiaWQiOiAidG1wX2syandwcnEwd3dhcXhrciIsInBhc3N3b3JkIjogIncxbzZzaWFyN295ZGl5ayJ9CSx7ImlkIjogInRtcF94bHFuMGJmOTZ6NzR1cGUiLCJwYXNzd29yZCI6ICJsbGw3enh6ZmhuNnVmYzEifQkseyJpZCI6ICJ0bXBfYmZlczBtaTcxcmUybzd4IiwicGFzc3dvcmQiOiAiemU1YjUzdzNqaHJwYmFkIn1dfX0=", "statusValid": true }
For that file output of "grep -o '"logURL":"[^"]*' "$file" | cut -d '"' -f4" would be:
https://dmaap-dr-prov/feedlog/1 https://dmaap-dr-prov/sublog/1
because sub also has the logURL field.
My temporary fix was changing the command to:
export DR_LOG_URL_"$NUM"="$(grep -o '"logURL":"[^"]*' "$file" | cut -d '"' -f4 | head -1)"
adding: | head -1 to get only the first line. That solution could be improved probably.
When there is more than one logURL there is no config for DFC in Consul and the config in application_config.yaml file is corrupted.