-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add os-release gatherer #283
Conversation
247a1c2
to
f24d3bb
Compare
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.
Looks good!
Add the gatherer to the list of gatherers please.
No need for a new review
log.Error(err) | ||
return facts, OSReleaseFileError.Wrap(err.Error()) | ||
} | ||
defer file.Close() |
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.
Let's puts some logs in this defer
. Just in case.
As we do in: https://github.com/trento-project/agent/blob/main/internal/factsengine/gatherers/groups.go#L61
return facts, nil | ||
} | ||
|
||
func mapToFactValue(inputMap map[string]string) entities.FactValue { |
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.
Rename this to mapOSReleaseToFactValue
or similar.
Keep in mind that this function is shared across all the package, and it looks too generic
@@ -0,0 +1,12 @@ | |||
NAME="Ubuntu" | |||
VERSION="20.04.3 LTS (Focal Fossa)" | |||
ID=ubuntu |
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.
I have always seen values wrapped in quotes. Does ubuntu have them without?
It would be nicer to put opensuse 🙈
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 quotes are not mandatory AFAIK, see some examples: https://manpages.ubuntu.com/manpages/focal/man5/os-release.5.html
I think they are only required when they include values with spaces in them.
I've added some openSUSE love in the mocked data :-)
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.
Hey man looks good to me! Nice work :)
This PR adds a new gatherer for the /etc/os-release file. It will take all the values present in the file and export them as a map.