influxdata / influxdata/influxdata-docker

Starting a v2 container throws property not found: `tls-cert`, `tls-key`

Open
#740 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
364
Forks
255
Avg merge
3h 18m
Merged PRs (30d)
7

Description

A [user reported ](https://community.influxdata.com/t/influxd-config-path-is-completely-broken/33926/2) the problem below in Community and I can consistently reproduce it.

```sh
/home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-cert
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-key
```

Note: While trying to troubleshoot, I removed all config files and was then able to run a container that didn't throw the `dasel` errors, and did throw the expected "missing TLS cert file" error. But, then after breaking it again, I wasn't able to repeat my "fix" by making the same changes.

Reproduced on my system.

OS: Mac OS X

In the following example, `$HOME/apps/influxdb-docker-files/data` and `$HOME/apps/influxdb-docker-files/config` are empty directories:

```sh
(env1) (base) ja@MacBook-Pro influx-docker-test % docker run \
-p 8086:8086 \
-v "$HOME/apps/influxdb-docker-files/data:/var/lib/influxdb2" \
-v "$HOME/apps/influxdb-docker-files/config:/etc/influxdb2-custom" \
-e INFLUXD_CONFIG_PATH="/etc/influxdb2-custom" \
-e INFLUXD_LOG_LEVEL=debug \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-e DOCKER_INFLUXDB_INIT_ORG=my-org \
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-e DOCKER_INFLUXDB_INIT_TOKEN=my-token \
influxdb:2 > log.out
Error: could not get read parser: read parser required when reading from stdin
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x40001b4ee8?)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x40001e9980?, 0x0?})
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x40001e9980, 0x16}, 0x0, 0x0, 0x0})
/home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
/home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x40006167a0, 0x0, 0x0})
/home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x400033cab0, 0x1, 0x4?})
/home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400050a400, 0x1ef874?, {0x40006167b0, 0x1, 0x40001b5668?})
/home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
/home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x40002f57c0)
/home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400050a400)
/home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
/home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x400033ca50}, {0xffffcc61dd01, 0x11}, {0x310e80?, 0x4000616790?})
/home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x40001b5c68, 0x37391c?)
/home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000184200?, {0x40002f5680, 0x1, 0x370836?})
/home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x40004b4300, {0x40002f5630, 0x5, 0x5})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x40004b4000)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x4000078000?)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
/home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x4000166ee8?)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x4000152020?, 0x0?})
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x4000152020, 0x16}, 0x0, 0x0, 0x0})
/home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
/home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x400001f690, 0x0, 0x0})
/home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x40001c61b0, 0x1, 0xffff671414b8?})
/home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400030b280, 0x1ef874?, {0x400001f6a0, 0x1, 0x4000167668?})
/home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
/home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x4000020370)
/home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400030b280)
/home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
/home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x40001c6150}, {0xffffd29fcd0f, 0x8}, {0x310e80?, 0x8e0ee0?})
/home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x4000167c68, 0x37391c?)
/home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000136200?, {0x4000020230, 0x1, 0x370836?})
/home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x400044a300, {0x40000201e0, 0x5, 0x5})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x400044a000)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x400008c000?)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
/home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x4000166ee8?)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x40001803c0?, 0x0?})
/opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x40001803c0, 0x16}, 0x0, 0x0, 0x0})
/home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
/home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x40003eb3f0, 0x0, 0x0})
/home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x40001c61b0, 0x1, 0xffff60f1cb98?})
/home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400030b280, 0x1ef874?, {0x40003eb400, 0x1, 0x4000167668?})
/home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
/home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x4000020370)
/home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400030b280)
/home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
/home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x40001c6150}, {0xffffc5d56d10, 0x7}, {0x310e80?, 0x8e0ee0?})
/home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x4000167c68, 0x37391c?)
/home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000136200?, {0x4000020230, 0x1, 0x370836?})
/home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x4000572300, {0x40000201e0, 0x5, 0x5})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x4000572000)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x400008c000?)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
/home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-cert
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-key
2024-04-17T21:40:32.192036801Z warn cleaning bolt and engine files to prevent conflicts on retry {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt", "engine_path": "/var/lib/influxdb2/engine"}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied docker run command with empty data and config mounts, then trace how INFLUXD_CONFIG_PATH reaches the container startup and dasel invocation. Inspect the referenced dasel entry points, including cmd/dasel/main.go, context.go, value.go, func_property.go, and internal/command/put.go. Done means the v2 container avoids the dasel property errors and panic and reaches the expected TLS configuration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, shell
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.