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

Label Templates: rework collection of 'System Data' info #840

Closed
wants to merge 6 commits into from

Conversation

fgiudici
Copy link
Member

@fgiudici fgiudici commented Sep 9, 2024

Allow automatic conversion of data to map[string]interface{} (Label Templates format) using reflection.
Add support to "old" variable names (that we may want to deprecate sooner or later, in the meanwhile we can just document the new syntax only) and add SMBIOS data collection from hostinfo package.

Drop dmidecode package as we SMBIOS data retrieval is now performed by the hostinfo package.
No more requirement on the dmidecode tool.

Fixes #834

Allow automatic conversion of data to map[string]interface{} (Template
Labels format) using reflection.
Add support to old variable names (to be deprecated sooner or later)
and add SMBIOS data collection from hostinfo package: this should allow
to drop dmidecode tool requirement for SMBIOS data retrieval.
also changed the 'raw' option to 'full' one, to allow dumping all the
available information using the same reflection based translation as
(partially) done with the regular collected Label Templates.
the hostinfo package is now able to collect all the data, also the
SMBIOS one: drop the dmidecode package.

Signed-off-by: Francesco Giudici <[email protected]>
@fgiudici fgiudici requested a review from a team as a code owner September 9, 2024 14:28
@github-actions github-actions bot added area/operator operator related changes area/register register related changes area/tests test related changes labels Sep 9, 2024
Copy link
Contributor

@anmazzotti anmazzotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Nice utility we have here!


cmd.Flags().BoolVarP(&full, "full", "f", false, "dump full, raw data before postprocessing to refine available label templates variables")
_ = viper.BindPFlag("full", cmd.Flags().Lookup("full"))
cmd.Flags().StringVarP(&output, "output", "o", "json", "output format ['"+OUTYAML+"', '"+OUTJSON+"', '"+OUTJSONCOMPACT+"']")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: could just be --format instead of --output.

@fgiudici
Copy link
Member Author

Closing in favor of #843 : reviewed the variable names and kept the old smbios and hardware legacy labels for now.

@fgiudici fgiudici closed this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operator operator related changes area/register register related changes area/tests test related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Label Templates: Hardware variables rework
2 participants