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

source/local: support comments in input

Lines starting with '#' are treated as comments and ignored when parsing
feature files and hook output.
This commit is contained in:
Markus Lehtonen 2023-08-04 15:34:13 +03:00
parent 6d30ca9660
commit 4aa7a8f8f8
2 changed files with 8 additions and 0 deletions

View file

@ -306,6 +306,7 @@ The hook stdout and feature files are expected to contain features in simple
key-value pairs, separated by newlines:
```plaintext
# This is a comment
<name>[=<value>]
```
@ -313,6 +314,8 @@ The label value defaults to `true`, if not specified.
Label namespace may be specified with `<namespace>/<name>[=<value>]`.
Comment lines (starting with `#`) are ignored.
### Mounts
The standard NFD deployments contain `hostPath` mounts for

View file

@ -150,6 +150,11 @@ func parseFeatures(lines [][]byte) map[string]string {
for _, l := range lines {
line := strings.TrimSpace(string(l))
if len(line) > 0 {
// Skip comment lines
if strings.HasPrefix(line, "#") {
continue
}
lineSplit := strings.SplitN(line, "=", 2)
key := lineSplit[0]