-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(misconf): do not skip loading documents from subdirectories #8526
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
Conversation
Signed-off-by: nikpivkin <[email protected]>
// The virtual file system uses a slash ('/') as a path separator, | ||
// but OPA uses the filepath package, which is OS-dependent. | ||
// Therefore, we need to collect all the paths ourselves and pass them to OPA. | ||
for _, root := range dataPaths { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the loading of data files on windows
} | ||
return nil | ||
}); err != nil { | ||
log.Error("Failed to collect data file paths", log.String("root", root), log.Err(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which test are you referring to? The link just points to scanner_test.go
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior ignores the error (if any) that gets returned by fs.WalkDir
. The test is simply simulating a case where an invalid filesystem is passed in and therefore fs.WalkDir
will return an error.
But should we return an error here if we are unable to override the filesystem for data? This would only happen if the passed in srcFS
isn't nil. In other cases we simply ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
srcFS
is only used to load data if no file system with data is passed through options. Therefore an error can occur in both cases. But I think I understood that the test is just checking that the data was not loaded.
Signed-off-by: nikpivkin <[email protected]>
Description
Checklist