Skip to content

Commit bd1acbd

Browse files
authored
hook-docker: fix: last kernel cmdline option would have a newline (#262)
hook-docker: fix: last kernel cmdline option would have a newline Example: ``` (ns: getty) HookOS 0.10.0:/var/log# cat -A /proc/cmdline coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 cgroup_disable=memory numa_policy=interleave snd_bcm2835.enable_hdmi=0  smsc95xx.macaddr=DC:A6:32:EC:8B:49 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=tty1 console=ttyAMA0,115200 loglevel=7 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory worker_id=rpi tink_worker_image=ghcr.io/tinkerbell/tink-agent:latest grpc_authority=tinkerbell:42113 tinkerbell_tls=false syslog_host=tinkerbell$ ``` Leading to: ``` tail -f /var/log/hook-docker.log <...snip...> failed to start daemon: failed to set log opts: failed to set log opts: parse "udp://tinkerbell\n:514": net/url: invalid control character in URL ``` Signed-off-by: Ricardo Pardini <[email protected]>
2 parents ec1075b + 2e36d2e commit bd1acbd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

images/hook-docker/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ func parseCmdLine(cmdLines []string) (cfg tinkConfig) {
106106
continue
107107
}
108108

109-
switch cmd := cmdLine[0]; cmd {
109+
switch cmd := strings.TrimSpace(cmdLine[0]); cmd {
110110
case "syslog_host":
111-
cfg.syslogHost = cmdLine[1]
111+
cfg.syslogHost = strings.TrimSpace(cmdLine[1])
112112
case "insecure_registries":
113-
cfg.insecureRegistries = strings.Split(cmdLine[1], ",")
113+
cfg.insecureRegistries = strings.Split(strings.TrimSpace(cmdLine[1]), ",")
114114
case "HTTP_PROXY":
115-
cfg.httpProxy = cmdLine[1]
115+
cfg.httpProxy = strings.TrimSpace(cmdLine[1])
116116
case "HTTPS_PROXY":
117-
cfg.httpsProxy = cmdLine[1]
117+
cfg.httpsProxy = strings.TrimSpace(cmdLine[1])
118118
case "NO_PROXY":
119-
cfg.noProxy = cmdLine[1]
119+
cfg.noProxy = strings.TrimSpace(cmdLine[1])
120120
}
121121
}
122122
return cfg

0 commit comments

Comments
 (0)