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

migrate away from erb #357

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

migrate away from erb #357

wants to merge 4 commits into from

Conversation

b4ldr
Copy link
Member

@b4ldr b4ldr commented Jan 17, 2025

update the templating code to move away from erb and where possible use the print_config function

This PR is currently a WIP, couple of outstanding things

  • we need to add a spec test for unbound::remote so before we merge this so we can ensure parity
  • confirm it's ok to quote all string values
    • if so what about yes/no values?
  • spec tests are failing, but the error message suggests they shouldn't (hoping to get some help on this which is why im creating the pr early)

Also happy to split this up into separate PRs if needed

# @summary Remove blank lines from a string
# @param content The content to remove blank lines from
# @return The content with blank lines removed
function unbound::clean_blank_lines (
Copy link
Member

Choose a reason for hiding this comment

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

I think this is generic enough that it could also be part of extlib?

$config_file = $unbound::config_file,
Array[Unbound::Resource_record_type] $local_data = [],
String $template_name = 'unbound/local_zone.erb'
Unbound::Local_zone_type $type,
Copy link
Member

Choose a reason for hiding this comment

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

I prefer the older style, with just a single whitespace. That makes the diff easier to read and makes git reverts / cherry-picks easier. But there's no consent in our style guide yet.

) {
$records = $local_data.map |$record| {
Copy link
Member

Choose a reason for hiding this comment

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

there's a lot going on here. Can you please add some comments about what's happening?

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.

2 participants