.env.example + compose: quote GNMI_ADDRESSES so compose's .env parser accepts it

Docker Compose's .env parser treats an unquoted mid-line comma as a
variable-name boundary. The current value:

  GNMI_ADDRESSES="10.100.0.100:57400", "10.100.0.200:57400"

fails compose pull / build / up with:
  failed to read .env: line 56: unexpected character "," in variable name

The double-quoted-list form is what telegraf.conf needs when it
substitutes `addresses = [ ${GNMI_ADDRESSES} ]`, but the raw comma is
what breaks compose. Wrap the whole value in SINGLE quotes: compose
treats it as a literal string (single-quoted values are not interpolated
and preserve special characters), and telegraf still gets the
double-quoted list body verbatim on substitution.

Also fix the docker-compose.yml default fallback -- same comma issue,
drop the second address from the default (users can extend via .env).

Found by the obmp-portability-test two-VM run.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
sam 2026-07-20 23:30:53 -07:00
parent 745f066dfd
commit 6df67a71d7
2 changed files with 10 additions and 2 deletions

View File

@ -53,7 +53,13 @@ EXABGP_MEM_LIMIT=6g
# gNMI streaming telemetry (telegraf, test profile). GNMI_ADDRESSES is a # gNMI streaming telemetry (telegraf, test profile). GNMI_ADDRESSES is a
# quoted, comma-separated host:port list — add a router here once gNMI/grpc # quoted, comma-separated host:port list — add a router here once gNMI/grpc
# is enabled on it and the management path is reachable. # is enabled on it and the management path is reachable.
GNMI_ADDRESSES="10.100.0.100:57400", "10.100.0.200:57400" # NOTE: the outer SINGLE quotes are required. Docker Compose's .env parser
# treats an unquoted mid-line comma as a variable-name boundary and errors
# out on the double-quoted list form; wrapping in single quotes makes it a
# literal string. Telegraf substitutes the string body verbatim into
# `addresses = [ ${GNMI_ADDRESSES} ]` in telegraf.conf, so the double
# quotes and comma inside are preserved.
GNMI_ADDRESSES='"10.100.0.100:57400", "10.100.0.200:57400"'
GNMI_USERNAME=changeme GNMI_USERNAME=changeme
GNMI_PASSWORD=changeme GNMI_PASSWORD=changeme

View File

@ -399,7 +399,9 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-openbmp} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-openbmp}
# gNMI fleet — quoted, comma-separated host:port list. Default = the two # gNMI fleet — quoted, comma-separated host:port list. Default = the two
# ESXi CORE routers; extend via GNMI_ADDRESSES in .env for more routers. # ESXi CORE routers; extend via GNMI_ADDRESSES in .env for more routers.
- 'GNMI_ADDRESSES=${GNMI_ADDRESSES:-"10.100.0.100:57400", "10.100.0.200:57400"}' # Default value must not contain an unquoted comma -- compose's parser
# treats it as a variable-name boundary. See .env.example note.
- GNMI_ADDRESSES=${GNMI_ADDRESSES:-"10.100.0.100:57400"}
- GNMI_USERNAME=${GNMI_USERNAME:-webui} - GNMI_USERNAME=${GNMI_USERNAME:-webui}
- GNMI_PASSWORD=${GNMI_PASSWORD:-cisco} - GNMI_PASSWORD=${GNMI_PASSWORD:-cisco}