Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source/local: support comments in input #1294

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
for _, l := range lines {
line := strings.TrimSpace(string(l))
if len(line) > 0 {
// Skip comment lines
if strings.HasPrefix(line, "#") {
continue

Check warning on line 155 in source/local/local.go

View check run for this annotation

Codecov / codecov/patch

source/local/local.go#L153-L155

Added lines #L153 - L155 were not covered by tests
}

lineSplit := strings.SplitN(line, "=", 2)

key := lineSplit[0]
Expand Down