Skip to content

convert ERB templates to EPP #1399

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

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

SimonHoenscheid
Copy link
Collaborator

rebase against #1396 after merge

@puppet-community-rangefinder
Copy link

postgresql::params is a class

Breaking changes to this file WILL impact these 2 modules (exact match):
Breaking changes to this file MAY impact these 3 modules (near match):

postgresql::server is a class

Breaking changes to this file WILL impact these 41 modules (exact match):
Breaking changes to this file MAY impact these 17 modules (near match):

postgresql::server::instance::config is a type

that may have no external impact to Forge modules.

postgresql::server::instance::systemd is a type

that may have no external impact to Forge modules.

postgresql::server::pg_hba_rule is a type

Breaking changes to this file WILL impact these 14 modules (exact match):
Breaking changes to this file MAY impact these 4 modules (near match):

postgresql::server::pg_ident_rule is a type

Breaking changes to this file WILL impact these 1 modules (exact match):
Breaking changes to this file MAY impact these 1 modules (near match):

postgresql::server::recovery is a type

that may have no external impact to Forge modules.

This module is declared in 70 of 580 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I like this, but wonder if it would make sense to add data types to the EPP files themselves. My biggest issue with ERB templates is that it's very easy to forget some (required) value and it silently proceeds. Data types are awesome to prevent that.

@SimonHoenscheid
Copy link
Collaborator Author

@ekohl good point!
You are thinking of a block like these right?

<%- | Boolean $keys_enable,
      String  $keys_file,
      Array   $keys_trusted,
      String  $keys_requestkey,
      String  $keys_controlkey
| -%>

I will add these.

@ekohl
Copy link
Collaborator

ekohl commented Feb 13, 2023

You are thinking of a block like these right?

Yes exactly.

@SimonHoenscheid SimonHoenscheid force-pushed the shoenscheid_epp_templates branch 2 times, most recently from 5fc3fd8 to 938e062 Compare February 14, 2023 09:15
Boolean $delete_before_dump,
String[1] $dir,
Enum['plain','custom','directory','tar'] $format,
Array $optional_args,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this Array[String[1]] or do we also expect Integer in there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took over the current types in #1397 or these which are currently in the module. If there are adjustments over all, I would do these later.

Comment on lines +9 to +10
Optional[String[1]] $post_script,
Optional[String[1]] $pre_script,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It calls flatten($pre_script) and flatten($post_script) which implies an Array is supported/expected. In addition to that, it may even be nested (given flatten is called). If you're doing a breaking change, I'd suggest Array[String[1]] and remove the flatten() call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see comment above

@@ -1,3 +1,20 @@
<%- |
Boolean $compress,
Array $databases,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could use Array[String[1]] $databases = [] and simplify the code. Right now it still deals with undef and it not being an Array.

Optional[Boolean] $recovery_target_inclusive,
Optional[String[1]] $recovery_target,
Optional[String[1]] $recovery_target_timeline,
Optional[Boolean] $pause_at_recovery_target,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I always find Optional[Boolean] interesting because it's usually equal to Boolean $var = false. Not always, since you can have a tri-state where undefined is special cased, but not here. So I'd suggest to simplify it here.

SimonHoenscheid and others added 2 commits February 14, 2023 14:56
  * add puppet/systemd module
  * remove systemd daemon reload and raise minimal puppet version to 6.1
  * remove old "drop-in file" removal, was in place 3 years now
  * move systemd drop-in file handling to seperate define
  * Implement recent feedback
  * define is now private
  * rename parameter in define call
  * fix unit tests
  * fix rubocop complains
  * fix path, set default fact
  * fix systemd drop in file, adding template parameters to systemd define
  * added reason for drop in file in a comment
@SimonHoenscheid SimonHoenscheid force-pushed the shoenscheid_epp_templates branch from 938e062 to 04d61cb Compare February 14, 2023 13:58
@SimonHoenscheid SimonHoenscheid marked this pull request as ready for review February 14, 2023 16:08
@SimonHoenscheid SimonHoenscheid requested a review from a team as a code owner February 14, 2023 16:08
Copy link
Collaborator

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

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

I think this is a good way forward an can be merged. Yes the types could be a bit stricter in some places, but the PR is already huge. I think this is good to go, then #1397 is a good enhancement. We can always improve the datatypes further.

@chelnak chelnak merged commit f1ee0e1 into puppetlabs:main Feb 15, 2023
@SimonHoenscheid SimonHoenscheid deleted the shoenscheid_epp_templates branch February 15, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants