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

Move params logic to hiera data #162

Open
nward opened this issue May 14, 2021 · 1 comment · May be fixed by #202
Open

Move params logic to hiera data #162

nward opened this issue May 14, 2021 · 1 comment · May be fixed by #202
Milestone

Comments

@nward
Copy link
Collaborator

nward commented May 14, 2021

The puppet language style guide (https://puppet.com/docs/puppet/7.6/style_guide.html) recommends using data binding rather than the params.pp pattern.

As well as being a more "modern" way of doing things, this also allows the user to override anything that params.pp would currently be calculating - making the module a lot more flexible.

This has the negative impact that the module's supported minimum Puppet version would be 4.9, as this is when Hiera 5 with in-module hiera data support was added. Given this was released in 2017 I think this is an OK minimum version.

The current minimum version is 4.0.0 (2015).

An example of this would be:
hiera.yaml:

---
version: 5

defaults:
  datadir: data
  data_hash: yaml_data

hierarchy:
  - name: "osfamily+osname/major release"
    paths:
      - "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
      - "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
  - name: "osfamily+osname"
    paths:
      - "os/%{facts.os.name}.yaml"
      - "os/%{facts.os.family}.yaml"
  - name: 'common'
    path: 'common.yaml'

data/debian/9.yaml:

---
freeradius::package: freeradius
freeradius::raddbdir: '${sysconfdir}/freeradius/3.0'
#... etc ...

It would also mean making most (if not all) of the fr_* variables be straight params on the freeradius class, i.e., for the above examples:

class freeradius (
  String $package,
  String $raddbdir,
#  .. etc ..
) {
# .. code ..
}
@cruelsmith
Copy link
Contributor

Did some testing on that one see https://github.com/pixelpark/puppet-freeradius/tree/migrate_to_hiera

Current issue are the spec tests since they using some magic i do not understand: https://github.com/djjudas21/puppet-freeradius/blob/main/spec/spec_helper_local.rb#L10-L31

@cruelsmith cruelsmith linked a pull request Aug 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants