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

fix parameter lookup #331

Merged
merged 1 commit into from Apr 26, 2022
Merged

fix parameter lookup #331

merged 1 commit into from Apr 26, 2022

Conversation

saz
Copy link
Owner

@saz saz commented Apr 20, 2022

Since the merge of #322 it wasn't possible to just manage server ssh::server or client ssh::client with this module.

This PR moves all parameters to the proper location (thanks to #325 this module uses data in modules), which should make things work as before again.

I've also added a few more tests in this PR

Fixes #324
Fixes #326
Fixes #329

@saz saz mentioned this pull request Apr 20, 2022
@saz saz force-pushed the fix-client-server-params branch 3 times, most recently from 4cf681f to 69aa770 Compare April 20, 2022 13:48
@SimonHoenscheid
Copy link
Contributor

Hi @saz, first of all, sorry if my PR has caused trouble. That was not my intention.

I had a look at this PR and I try to sum up what I understood:

The reason for this PR and my PR which declared the ssh::client and ssh::server class as private was to solve the duplicate declaration which started, when I moved the module to Data in Modules.

From my understanding of the Puppet language it is best practice to introduce all variables as class parameters in the main class and access this parameter from a subclass to load the value.

Before introducing Data in Modules the default parameters were stored in the params.pp and were loaded from there. This was best practice, when params.pp was the way to go and even back then a lot of modules loaded the defaults to the init.pp and accessed the variable from an other class.

When declaring the module with a simple include every seperate declaration of the client or server class will be a duplicate, because, init.pp is already loading it.

Loading the parameters from the subclass looks uncommon for me, even if it solves the problem and can be overwritten from the main class.

Just a few thoughts
Simon

@saz
Copy link
Owner Author

saz commented Apr 21, 2022

Hi @SimonHoenscheid

Your understanding is correct and I don't see any trouble here 😄 Test should have been improved a long time ago and would have make this issue visible before anything gets merged.

That's what I did now: tests should reflect the behavior of this module.

The main class of this module is - and always has been - some kind of convenience thing for the majority of use-cases: manage both client and server in a standard way by just include ssh.
It's discussable if this is good or bad, but at the same time, there are a couple of modules doing the same.

There are still a few things, I'm not sure, if it should stays like that or if it should be changed.
One example from manifests/server/config.pp:

class ssh::server::config {
  assert_private()

  $options = $ssh::server::merged_options

$options might also be a class parameter and instead of doing an include ssh::server::config, it's possible to just do a

class { 'ssh::server::config':
  options => $merged_options,
}

which will make things even more configurable.

I appreciate the time you're investing and if you still have any feedback on this PR, it's more than welcome.

I'm planning on merging this on the weekend.
@smoeding Already provided some feedback in #324 which helped in fixing an issue I would have introduced with this PR.

I'm (almost) happy with the way this PR looks (even if it's huge!) and how everything's working (hopefully: as before v9 😄 )

Copy link
Contributor

@SimonHoenscheid SimonHoenscheid left a comment

Choose a reason for hiding this comment

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

private API marking needs removal in L1, server.pp

@saz saz force-pushed the fix-client-server-params branch from 37e836d to 6c27ef7 Compare April 26, 2022 08:54
@saz saz merged commit f3e76a3 into master Apr 26, 2022
@saz
Copy link
Owner Author

saz commented Apr 26, 2022

PR merged 🚀

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 this pull request may close these issues.

Undefined default parameter for ssh::server::match_block
2 participants