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 'hostinfo' data and collected variables #843

Merged
merged 4 commits into from
Sep 13, 2024

Conversation

fgiudici
Copy link
Member

Quite some changes in this PR:

  • Allow automatic conversion of data to map[string]interface{} (Label Templates format) using reflection; still, collect manually partial data from the hostinfo data for some subsystems to just pick useful data.
  • Use variable names from hostinfo: in particular, drop spaces in variable names.
  • Try to keep consistent variable names/path.
  • Expose NICs and Disks also by number, to enable listing also when the device name is not known.
  • Get SMBIOS data directly from hostinfo with update var names: System Information data still transmitted in parallel but deprecated (and when removed we can drop also the dmidecode tool requirement).
  • Keep the old variable naming enabled: they should be now deprecated and removed in the future.

The elemental-registry dump command now allows to print the three label data sets ('smbios', 'legacy' and 'hostinfo', where 'hostinfo' is the new set) in different formats (actual labels, json or yaml).

Fixes #834

Replaces #840

@fgiudici fgiudici requested a review from a team as a code owner September 11, 2024 14:34
@github-actions github-actions bot added area/operator operator related changes area/register register related changes area/tests test related changes labels Sep 11, 2024
Allow automatic conversion of data to map[string]interface{} (Template
Labels format) using reflection where all data can be useful.
Still do manual collection of data in the map[string]interface{} when
dropping of part of the data is needed.

Use the original hostinfo field names, drop spaces in the keys.
Import also the SMBIOS data from hostinfo, since are there (so also
without dmidecode tool some SMBIOS info will be available).

Keep support of old HARDWARE variable (to be deprecated sooner or
later).

Signed-off-by: Francesco Giudici <[email protected]>
@fgiudici fgiudici force-pushed the label-templates-rework2 branch 2 times, most recently from fbcc93a to 7c3ea82 Compare September 12, 2024 07:09
notably the "label" output format, which is now the default

Signed-off-by: Francesco Giudici <[email protected]>
we don't want to break possible setups using the older Label Templates
variables: send both.

Signed-off-by: Francesco Giudici <[email protected]>
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

@fgiudici fgiudici merged commit 723d7c3 into rancher:main Sep 13, 2024
22 checks passed
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