Skip to content

Commit

Permalink
Merge pull request #1294 from marquiz/devel/feature-file-comments
Browse files Browse the repository at this point in the history
source/local: support comments in input
  • Loading branch information
k8s-ci-robot committed Aug 4, 2023
2 parents 6d30ca9 + 4aa7a8f commit 35fbbaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/usage/customization-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ 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>]
```

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
Expand Down
5 changes: 5 additions & 0 deletions source/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 35fbbaa

Please sign in to comment.