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

HDM should be able to read global hiera data #330

Closed
tuxmea opened this issue Mar 14, 2024 Discussed in #299 · 6 comments · Fixed by #351
Closed

HDM should be able to read global hiera data #330

tuxmea opened this issue Mar 14, 2024 Discussed in #299 · 6 comments · Fixed by #351
Assignees
Labels
enhancement New feature or request

Comments

@tuxmea
Copy link
Member

tuxmea commented Mar 14, 2024

Discussed in #299

Originally posted by tuxmea February 15, 2024
In some environments, the global hiera data is used (/etc/puppetlabs/puppet/hiera.yaml)
HDM should be able to also show global data.

Workflow in HDM:

  • select environment
  • select node
  1. Global data:

HDM now reads the global hiera.yaml file, replaces the facts and finds the yaml files for the node and collects all Hiera keys.
The global hiera.yaml file may be absent. It should only be taken into account if it has a hierarchy key.

  1. Environment data:

HDM reads the environment hiera.yaml file, replaces the facts and finds the yaml files for the node and collects all Hiera keys.

  1. Select a key

When selecting a Hiera key, HDM should show the global directory/file structure similar to environment data on top of the environment data.
Global data and environment data views are each have a border around to visualize that these are different data sources.

  1. Show result

Show result must first parse global data and environment data afterwards.
lookup_options are dealt in the same way as single environment data.

@tuxmea tuxmea added the enhancement New feature or request label Mar 14, 2024
@oneiros
Copy link
Collaborator

oneiros commented Mar 28, 2024

I am knee deep into implementing this. It took quite a while but I am finally getting somewhere.

Here is a sneak peek:

image

I have a question about the location of the global layer's hiera.yml file, though:

According to the hiera docs the location of the global hiera.yaml is $confdir/hiera.yaml by default and can be overridden in puppet.conf (as, I suspect, can $confdir). So it is not always in a fixed location.

Since I assume we do not want to start parsing puppet.conf, how about we add a configuration option to hdm.yml to set the location? This would also be very helpful for testing purposes.

@tuxmea
Copy link
Member Author

tuxmea commented Apr 2, 2024

looks good. And yes: please make the location of the global hiera.yaml file configurable.

@tuxmea
Copy link
Member Author

tuxmea commented Apr 3, 2024

One minor request: Instead of Layer: global and Layer: environment:

please use Scope: global and Scope: environment.

Otherwise people might get confused with hiera hierarchy layers.

@oneiros
Copy link
Collaborator

oneiros commented Apr 8, 2024

One minor request: Instead of Layer: global and Layer: environment:

please use Scope: global and Scope: environment.

I would be happy to use better terminology. But just to make sure: Do you really think is correct? The documentation very consistently refers to the different levels as "layers". They are introduced here:

https://www.puppet.com/docs/puppet/8/hiera_intro.html#hiera_config_layers

And they are referred to several times, e.g. here: https://www.puppet.com/docs/puppet/8/hiera_automatic#puppet_lookup, always as "layers".

Also, when I use the search feature on the documentation page, the top results for "layers" all refer to the these levels of configuration while a search for "scope" returns only results not related to this concept at all 🤷‍♂️

@tuxmea
Copy link
Member Author

tuxmea commented Apr 9, 2024

One minor request: Instead of Layer: global and Layer: environment:
please use Scope: global and Scope: environment.

I would be happy to use better terminology. But just to make sure: Do you really think is correct? The documentation very consistently refers to the different levels as "layers". They are introduced here:

https://www.puppet.com/docs/puppet/8/hiera_intro.html#hiera_config_layers

And they are referred to several times, e.g. here: https://www.puppet.com/docs/puppet/8/hiera_automatic#puppet_lookup, always as "layers".

Also, when I use the search feature on the documentation page, the top results for "layers" all refer to the these levels of configuration while a search for "scope" returns only results not related to this concept at all 🤷‍♂️

You are absolutely right!
Please use the term 'layers'.

oneiros added a commit that referenced this issue Apr 9, 2024
And take "global" layer into account when querying data.
@tuxmea
Copy link
Member Author

tuxmea commented Apr 10, 2024

Layout issue with short list of data:
image

oneiros added a commit that referenced this issue Apr 10, 2024
Fixes the problem displayed here:
#330 (comment)
oneiros added a commit that referenced this issue Apr 10, 2024
And take "global" layer into account when querying data.
oneiros added a commit that referenced this issue Apr 10, 2024
Fixes the problem displayed here:
#330 (comment)
oneiros added a commit that referenced this issue Apr 12, 2024
And take "global" layer into account when querying data.
oneiros added a commit that referenced this issue Apr 12, 2024
Fixes the problem displayed here:
#330 (comment)
oneiros added a commit that referenced this issue Apr 12, 2024
* Add hiera layer abstraction ... #330

And take "global" layer into account when querying data.

* Remove obsolete error class.

* Make location of global hiera.yaml configurable #330

* Fix typo.

* Fix markup #330

Fixes the problem displayed here:
#330 (comment)

* Small fix for rubocop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants