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

Cleanup legacy facts and add puppet strings #199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cruelsmith
Copy link
Contributor

@cruelsmith cruelsmith commented Aug 16, 2023

Pull Request (PR) description

  • Fix legacy fact usage
  • Fix top var scope usage
  • Fix some indent issues
  • Add minimal puppet strings formatting

JFYI: REFERENCE.md can be updated after this PR via

# setup bundle
bundle config set --local path "vendor/bundle"
bundle config set --local without "system_tests"
bundle install --jobs $(nproc)

# generate REFERENCE.md
bundle exec puppet strings generate --format markdown --out REFERENCE.md

This Pull Request (PR) fixes the following issues

None

@djjudas21
Copy link
Owner

@cruelsmith I just merged #198 so could you rebase this and fix conflicts please. Thanks

Copy link
Contributor Author

@cruelsmith cruelsmith left a comment

Choose a reason for hiding this comment

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

I also found some heredocs that is could not fix since the parameter comma was before the end of the heredoc. Best would be to remove the heredoc usage at all.

content => @(BLANK/L),

content => @("SYSCONFIG"),

Interesting was also that you are inconsistent on when to use a variable like $freeradius::fr_version or freeradius::params::fr_version:

if $freeradius::fr_version !~ /^3/ {

FYI: There are still some PDK warnings that has not been fixed by me. See forexample https://github.com/djjudas21/puppet-freeradius/actions/runs/5879050878/job/15942322938?pr=199#step:4:16
I would recommend to add --fail-on-warnings to .puppet-lint.rc so that the CI fails when also warnings exist. This can be also be added with

Rakefile:
  linter_fail_on_warnings: true

into .sync.yaml to make it persistent on pdk updates.

manifests/module/ldap.pp Outdated Show resolved Hide resolved
@cruelsmith cruelsmith force-pushed the fixing_syntax_and_puppet_strings branch from 143b5c9 to f57fe56 Compare August 16, 2023 12:55
@djjudas21 djjudas21 changed the title Fix missing requries, cleanup legacy fascts and add puppet strings Fix missing requires, cleanup legacy facts and add puppet strings Aug 16, 2023
manifests/init.pp Outdated Show resolved Hide resolved
@cruelsmith cruelsmith marked this pull request as draft August 16, 2023 19:09
@cruelsmith cruelsmith force-pushed the fixing_syntax_and_puppet_strings branch from f57fe56 to ad4d993 Compare August 16, 2023 19:26
@cruelsmith cruelsmith changed the title Fix missing requires, cleanup legacy facts and add puppet strings Cleanup legacy facts and add puppet strings Aug 16, 2023
@cruelsmith
Copy link
Contributor Author

cruelsmith commented Aug 16, 2023

Removed my require freeradius::params proposal since it will likely break things. At least in my test that i did to migrate the module to use hiera everything of the rspec breaks. Will open a separate issue for that one.
The remaining changes are fine as they are.

Just now saw that the https://github.com/djjudas21/puppet-freeradius/blob/main/README.md?plain=1#L79 provides a description of the paramters that i did not migrate to the puppet strings. Cloud be also be a todo for this PR.

@cruelsmith cruelsmith marked this pull request as ready for review August 16, 2023 19:34
Copy link
Collaborator

@nward nward left a comment

Choose a reason for hiding this comment

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

I have added a few comments. In general I think this is good tidy up work - thanks @cruelsmith !

I am opposed to adding empty @param lines to the documentation, as this sets a poor precedent I think. Instead we should either:

  1. write documentation
  2. mark them to be ignored, require documentation with PRs introducing new params, and create some issues to go and write documentation for the existing ones (perhaps as smaller PRs rather than one big PR addressing the whole lot)

manifests/init.pp Outdated Show resolved Hide resolved
@@ -8,19 +31,19 @@
Freeradius::Boolean $require_message_authenticator = 'no',
Optional[String] $virtual_server = undef,
Optional[Enum[
Copy link
Collaborator

Choose a reason for hiding this comment

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

My suggestion is that here (and for all the other indent changes where this is relevant) instead of jumping straight from 2 to 6 space indent, we include the intermediate indent on its own line, so that it is clear why this is happening.

Suggested change
Optional[Enum[
Optional[
Enum[

manifests/radsniff.pp Show resolved Hide resolved
@cruelsmith cruelsmith force-pushed the fixing_syntax_and_puppet_strings branch 2 times, most recently from 8382592 to 6a8855c Compare August 17, 2023 09:29
@cruelsmith cruelsmith requested a review from nward August 17, 2023 10:43
Copy link
Collaborator

@nward nward left a comment

Choose a reason for hiding this comment

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

Hi @cruelsmith - lots of great work here, thank you very much.

On the documentation commit:
Great stuff. I note that there are some params documentation lines with no text, just the prefix. Can we remove these, or if they are easy (lots of them are source, ensure, etc. which will be the same across the board) let's add in some documentation.

In the cases where adding documentation for a param is going to be a bit more work than you want to put in (and you have put in a lot, so I am not asking you to put in any more!) let's remove the documentation prefix line and then either:

  1. suppress the warning with the linter comment
  2. accept that the warning will be generated

My preference is (2) because it will encourage us to actually go and sort out those few documentation lines, however as you are clearly focussed on removing linter warnings I think (1) would be fine as well - as we can very easily grep for suppressed documentation lines, and reference them in an issue.

I see you have copied the documentation from the current README verbatim which is probably the right approach here. Separate to this, I think we need to make a conscious decision re. the documentation to either:

  1. document how FreeRADIUS will behave when the parameter is used
  2. document how this module will behave when the parameter is used

I appreciate that we currently do (1), and I am not proposing we change that in this PR, but we should have a discussion about it. I think we would be well advised to use (2), and simply say that x parameter will set y parameter in z module, rather than try and track what FreeRADIUS behaviour is and how it changes over times and between different versions.

I will create an issue to discuss this.

I will also create an issue to proof read the params documentation - there are a few little typos and things but these should not be your responsibility :-)

On the radsniff commit:
I will need to review this further, as there was some reason that this weird logic (and I accept that it is pretty weird) existed.
I am not clear why this commit is part of this PR - can we break it out in to a separate PR instead, targeted at tidying up radsniff specifically, to keep the changes per PR low and easier to review?

@nward nward mentioned this pull request Aug 18, 2023
@cruelsmith
Copy link
Contributor Author

cruelsmith commented Aug 18, 2023

Removing the @param without comments again is not an option. When they are removed the puppet strings generation would skip these parameters and the resulting REFERENCE.md would also miss them. Which means nobody will know that they exist at all without also reading the code itself.
In my 👀 doing a review with #205 is sufficient for this.

That strange radsniff stuff is also touched with #202. Both remove that unneeded / not nice used logic.
Yes could also do a separated PR for that one. Since you asked and i was on it i added it here.

@nward
Copy link
Collaborator

nward commented Aug 18, 2023

Removing the @param without comments again is not an option. When they are removed the puppet strings generation would skip these parameters and the resulting REFERENCE.md would also miss them. Which means nobody will know that they exist at all without also reading the code itself.

Ah, I see. Perhaps we can add some # TODO: add docs comments to the end of the empty params lines, so they are easy to find in the future?

Yes let's break the radsniff rework in to a separate PR. For clarity, is your suggestion that I do that, or, did you want to do that?

@cruelsmith cruelsmith force-pushed the fixing_syntax_and_puppet_strings branch from 6a8855c to 6e871e1 Compare August 18, 2023 12:48
@cruelsmith
Copy link
Contributor Author

Rebased and moved the radsniff rework to #208 instead.

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.

None yet

3 participants