1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-28 02:37:11 +00:00

source/local: trim whitespace from input

Trim leading and trailing whitespace from the input (from feature files
and hooks). Makes it a bit more relaxed on the expected input format.
This commit is contained in:
Markus Lehtonen 2023-08-04 15:24:46 +03:00
parent 45dc46ab81
commit 181b4e0168

View file

@ -147,9 +147,10 @@ func (s *localSource) GetFeatures() *nfdv1alpha1.Features {
func parseFeatures(lines [][]byte) map[string]string {
features := make(map[string]string)
for _, line := range lines {
for _, l := range lines {
line := strings.TrimSpace(string(l))
if len(line) > 0 {
lineSplit := strings.SplitN(string(line), "=", 2)
lineSplit := strings.SplitN(line, "=", 2)
key := lineSplit[0]