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 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

### Functions

* [`unbound::clean_blank_lines`](#unbound--clean_blank_lines): Remove blank lines from a string
* [`unbound::print_config`](#unbound--print_config): Print a configuration value if it is defined and the version is supported
* [`unbound::split_txt`](#unbound--split_txt): function to split TXT records. Long TXT records must be broken into strings of 255 characters as per RFC 4408

### Data types

Expand Down Expand Up @@ -2357,7 +2359,7 @@ Custom type Unbound::Local_zone_type.

##### <a name="-unbound--localzone--config_file"></a>`config_file`

Data type: `Any`
Data type: `Stdlib::Absolutepath`

name of configuration file.

Expand Down Expand Up @@ -2537,13 +2539,31 @@ Default value: `undef`

## Functions

### <a name="unbound--clean_blank_lines"></a>`unbound::clean_blank_lines`

Type: Puppet Language

Remove blank lines from a string

#### `unbound::clean_blank_lines(String[1] $content)`

The unbound::clean_blank_lines function.

Returns: `String[1]` The content with blank lines removed

##### `content`

Data type: `String[1]`

The content to remove blank lines from

### <a name="unbound--print_config"></a>`unbound::print_config`

Type: Puppet Language

Print a configuration value if it is defined and the version is supported

#### `unbound::print_config(String[1] $name, Optional[Variant[Boolean, Integer, String, Array[String, 1]]] $value = undef, Optional[String[1]] $version = undef)`
#### `unbound::print_config(String[1] $name, Optional[Variant[Boolean, Integer, String, Array[String]]] $value = undef, Optional[String[1]] $version = undef)`

The unbound::print_config function.

Expand All @@ -2557,7 +2577,7 @@ the config item name

##### `value`

Data type: `Optional[Variant[Boolean, Integer, String, Array[String, 1]]]`
Data type: `Optional[Variant[Boolean, Integer, String, Array[String]]]`

the config item value

Expand All @@ -2567,6 +2587,24 @@ Data type: `Optional[String[1]]`

the version when the config item was introduced

### <a name="unbound--split_txt"></a>`unbound::split_txt`

Type: Puppet Language

function to split TXT records. Long TXT records must be broken into strings of 255 characters as per RFC 4408

#### `unbound::split_txt(String[1] $data)`

The unbound::split_txt function.

Returns: `String[1]` A string of 255 character strings

##### `data`

Data type: `String[1]`

A TXT record to split

## Data types

### <a name="Unbound--Access_control"></a>`Unbound::Access_control`
Expand Down
8 changes: 8 additions & 0 deletions functions/clean_blank_lines.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @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?

Copy link
Member Author

Choose a reason for hiding this comment

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

String[1] $content,
) >> String[1] {
return $content.split("\n").filter |$x| { !$x.empty }.join("\n")
}
5 changes: 4 additions & 1 deletion functions/print_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# @return the config item as a string or an empty string if the version is not supported
function unbound::print_config (
String[1] $name,
Optional[Variant[Boolean, Integer, String, Array[String, 1]]] $value = undef,
Optional[Variant[Boolean, Integer, String, Array[String]]] $value = undef,
Optional[String[1]] $version = undef,
) >> String {
$unbound_version = $facts['unbound_version'].lest || { '0.a' }
if ($value =~ Undef or ($version =~ NotUndef and versioncmp($unbound_version, $version) < 0)) {
return ''
}
if $value =~ Array and $value.empty {
return ''
}
$value ? {
String => " ${name}: \"${value}\"",
Integer => " ${name}: ${value}",
Expand Down
8 changes: 8 additions & 0 deletions functions/split_txt.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @summary function to split TXT records. Long TXT records must be broken into strings of 255 characters as per RFC 4408
# @param data A TXT record to split
# @return A string of 255 character strings
function unbound::split_txt(
String[1] $data
) >> String[1] {
$data.slice(255).map |$slice| { "\"${slice.join}\"" }.join
}
2 changes: 1 addition & 1 deletion manifests/dnstap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
concat::fragment { 'unbound-dnstap':
order => '20',
target => $unbound::config_file,
content => $config.split("\n").filter |$x| { !$x.empty }.join("\n"),
content => $config.unbound::clean_blank_lines(),
}
}
}
11 changes: 10 additions & 1 deletion manifests/forward.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@
Pattern[/yes|no/] $forward_tls_upstream = 'no',
$config_file = $unbound::config_file,
) {
$content = @("CONTENT")
forward-zone:
${unbound::print_config('name', $zone)}
${unbound::print_config('forward-addr', $address)}
${unbound::print_config('forward-host', $host)}
${unbound::print_config('forward-first', $forward_first)}
${unbound::print_config('forward-ssl-upstream', $forward_ssl_upstream)}
${unbound::print_config('forward-tls-upstream', $forward_tls_upstream)}
| CONTENT
concat::fragment { "unbound-forward-${name}":
order => '20',
target => $config_file,
content => template('unbound/forward.erb'),
content => $content.unbound::clean_blank_lines(),
}
}
31 changes: 25 additions & 6 deletions manifests/localzone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,34 @@
# @param template_name Use a custom template.
#
define unbound::localzone (
Unbound::Local_zone_type $type,
String $zone = $name,
$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.

Copy link
Member Author

Choose a reason for hiding this comment

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

I hear you but the rest of this module uses this style and I prefer consistency. But consistency across viz would be great so let's try and get something in the style guide and then we can creat a puppet lint check and fix to get everything fixed?

String $zone = $name,
Stdlib::Absolutepath $config_file = $unbound::config_file,
String $template_name = 'unbound/local_zone.erb',
Array[Unbound::Resource_record_type] $local_data = [],
) {
# Loop through the local_data hash and create ablock of local-data strings with the correctly formated
# local-data lines which are ued in the final content block below.
# local-data: 'api.test.com 15 300 IN A 192.0.2.1
$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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair comment will do

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated let me know what's missing?

$data = $record['data']
$_data = $record['type'] ? {
'TXT' => $data.unbound::split_txt(),
default => $data,
}
$record_txt = "${record['name']} ${record['ttl']} ${record['class']} ${record['type']} ${_data}".regsubst(
/\s+/, ' ', 'G'
) # Remove multiple spaces
" local-data: '${record_txt}'"
}.join("\n")
$content = @("CONTENT")
server:
local-zone: "${zone}" ${type}
${records}
| CONTENT
concat::fragment { "unbound-localzone-${name}":
order => '06',
target => $config_file,
content => template($template_name),
content => $content,
}
}
15 changes: 14 additions & 1 deletion manifests/remote.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,23 @@
$config_file = $unbound::config_file,
$control_setup_path = $unbound::control_setup_path,
) {
$_tls_config = @("CONFIG")
${unbound::print_config('server-key-file', $server_key_file)}
${unbound::print_config('server-cert-file', $server_cert_file)}
${unbound::print_config('control-key-file', $control_key_file)}
${unbound::print_config('control-cert-file', $control_cert_file)}
| CONFIG
$tls_config = $control_use_cert.bool2str($_tls_config, '')
$content = @("CONFIG")
${unbound::print_config('control-enable', $enable)}
${unbound::print_config('control-interface', $interface)}
${unbound::print_config('control-port', $port)}
${tls_config}
| CONFIG
concat::fragment { 'unbound-remote':
order => '10',
target => $config_file,
content => template('unbound/remote.erb'),
content => $content.unbound::clean_blank_lines(),
}

unless $control_setup_path.empty {
Expand Down
12 changes: 10 additions & 2 deletions manifests/stub.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Controls 'stub-first' stub zone option.
# If true, a query that fails with the stub clause is attempted again
# without the stub clause.
# @param type
# @param type
# can be 'deny', 'refuse', 'static', 'transparent', 'typetransparent', 'redirect' or 'nodefault'.
# @param config_file Name of the unbound config file
#
Expand All @@ -37,10 +37,18 @@
) {
include unbound
$_config_file = pick($config_file, $unbound::config_file)
$content = @("CONFIG")
stub-zone:
${unbound::print_config('name', $name)}
${unbound::print_config('stub-addr', $address)}
${unbound::print_config('stub-host', $nameservers)}
${unbound::print_config('stub-first', $stub_first)}
${unbound::print_config('stub-no-cache', $no_cache)}
| CONFIG
concat::fragment { "unbound-stub-${name}":
order => '15',
target => $_config_file,
content => template('unbound/stub.erb'),
content => $content.unbound::clean_blank_lines,
}

if str2bool($insecure) == true {
Expand Down
41 changes: 24 additions & 17 deletions spec/defines/stub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_unbound__stub('lab.example.com') }

it {

Check failure on line 22 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-8-x86_64 basic is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 22 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-9-x86_64 basic is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 22 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-8-x86_64 basic is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 22 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-9-x86_64 basic is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with(
content: <<~ZONE
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content(
<<~ZONE
stub-zone:
name: "lab.example.com"
stub-addr: ::1
stub-addr: "::1"
stub-first: no
stub-no-cache: no
ZONE
)
}
Expand All @@ -41,14 +43,16 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_unbound__stub('lab.example.com') }

it {

Check failure on line 46 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-8-x86_64 unbound::address is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "10.0.0.10@10053" stub-host: "ns1.example.com" stub-host: "ns2.example.com" stub-first: no stub-no-cache: no ZONE expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 46 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-9-x86_64 unbound::address is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "10.0.0.10@10053" stub-host: "ns1.example.com" stub-host: "ns2.example.com" stub-first: no stub-no-cache: no ZONE expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 46 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-8-x86_64 unbound::address is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "10.0.0.10@10053" stub-host: "ns1.example.com" stub-host: "ns2.example.com" stub-first: no stub-no-cache: no ZONE expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 46 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-9-x86_64 unbound::address is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "10.0.0.10@10053" stub-host: "ns1.example.com" stub-host: "ns2.example.com" stub-first: no stub-no-cache: no ZONE expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with(
content: <<~ZONE
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content(
<<~ZONE
stub-zone:
name: "lab.example.com"
stub-addr: 10.0.0.10@10053
stub-host: ns1.example.com
stub-host: ns2.example.com
stub-addr: "10.0.0.10@10053"
stub-host: "ns1.example.com"
stub-host: "ns2.example.com"
stub-first: no
stub-no-cache: no
ZONE
)
}
Expand All @@ -65,12 +69,13 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_unbound__stub('lab.example.com') }

it {

Check failure on line 72 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-8-x86_64 with no_cache set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 72 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-9-x86_64 with no_cache set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 72 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-8-x86_64 with no_cache set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 72 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-9-x86_64 with no_cache set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with(
content: <<~ZONE
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content(
<<~ZONE
stub-zone:
name: "lab.example.com"
stub-addr: ::1
stub-addr: "::1"
stub-first: no
stub-no-cache: yes
ZONE
)
Expand All @@ -88,13 +93,14 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_unbound__stub('lab.example.com') }

it {

Check failure on line 96 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-8-x86_64 with stub_first set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: yes stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 96 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-9-x86_64 with stub_first set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: yes stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 96 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-8-x86_64 with stub_first set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: yes stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 96 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-9-x86_64 with stub_first set is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: yes stub-no-cache: no ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with(
content: <<~ZONE
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content(
<<~ZONE
stub-zone:
name: "lab.example.com"
stub-addr: ::1
stub-addr: "::1"
stub-first: yes
stub-no-cache: no
ZONE
)
}
Expand All @@ -111,12 +117,13 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_unbound__stub('lab.example.com') }

it {

Check failure on line 120 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-8-x86_64 with address set as string is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 120 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

unbound::stub on almalinux-9-x86_64 with address set as string is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 120 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-8-x86_64 with address set as string is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string

Check failure on line 120 in spec/defines/stub_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

unbound::stub on almalinux-9-x86_64 with address set as string is expected to contain Concat::Fragment[unbound-stub-lab.example.com] with content supplied string Failure/Error: expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content( <<~ZONE stub-zone: name: "lab.example.com" stub-addr: "::1" stub-first: no stub-no-cache: yes ZONE ) expected that the catalogue would contain Concat::Fragment[unbound-stub-lab.example.com] with content set to supplied string
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with(
content: <<~ZONE
expect(subject).to contain_concat__fragment('unbound-stub-lab.example.com').with_content(
<<~ZONE
stub-zone:
name: "lab.example.com"
stub-addr: ::1
stub-addr: "::1"
stub-first: no
stub-no-cache: yes
ZONE
)
Expand Down
20 changes: 20 additions & 0 deletions spec/functions/clean_blank_lines_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require 'spec_helper'

input = <<-TEXT
string_name: "string_value"

int_name: 42

true_name: yes
TEXT
output = <<-TEXT
string_name: "string_value"
int_name: 42
true_name: yes
TEXT

describe 'unbound::clean_blank_lines' do
it { is_expected.to run.with_params(input).and_return(output) }
end
9 changes: 9 additions & 0 deletions spec/functions/split_txt_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

require 'spec_helper'
input = "Long TXT Record #{'X' * 255}"
output = "\"Long TXT Record #{'X' * 239}\"\"#{'X' * 16}\""

describe 'unbound::split_txt' do
it { is_expected.to run.with_params(input).and_return(output) }
end
17 changes: 0 additions & 17 deletions templates/forward.erb

This file was deleted.

15 changes: 0 additions & 15 deletions templates/local_zone.erb

This file was deleted.

Loading
Loading