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

Replace icinga2::newline function with icinga::newline #747

Merged
merged 1 commit into from
Dec 22, 2023
Merged
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
19 changes: 0 additions & 19 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ with or without TLS information.
* [`icinga2::icinga2_attributes`](#icinga2--icinga2_attributes): Calls the simple parser to decide what to quote.
For more information, see lib/puppet_x/icinga2/utils.rb.
* [`icinga2::icinga2_ticket_id`](#icinga2--icinga2_ticket_id): Summarise what the function does here
* [`icinga2::newline`](#icinga2--newline): Replace newlines for Windows systems.
* [`icinga2::parse`](#icinga2--parse)
* [`icinga2::unwrap`](#icinga2--unwrap): This function returns an unwrap string if necessary.

Expand Down Expand Up @@ -5699,24 +5698,6 @@ Data type: `Variant[String, Sensitive[String]]`

The ticket salt of the Icinga CA.

### <a name="icinga2--newline"></a>`icinga2::newline`

Type: Puppet Language

Replace newlines for Windows systems.

#### `icinga2::newline(Optional[String] $text)`

The icinga2::newline function.

Returns: `String` Text with correct newlines.

##### `text`

Data type: `Optional[String]`



### <a name="icinga2--parse"></a>`icinga2::parse`

Type: Puppet Language
Expand Down
25 changes: 0 additions & 25 deletions functions/newline.pp

This file was deleted.

8 changes: 2 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
)

if $facts['kernel'] != 'windows' {
$template_constants = icinga2::parse($constants)
$template_mainconfig = $_mainconfig
$file_permissions = '0640'
} else {
$template_constants = regsubst(icinga2::parse($constants), '\n', "\r\n", 'EMG')
$template_mainconfig = regsubst($_mainconfig, '\n', "\r\n", 'EMG')
$file_permissions = undef
}

Expand All @@ -35,12 +31,12 @@

file { "${conf_dir}/constants.conf":
ensure => file,
content => $template_constants,
content => icinga::newline(icinga2::parse($constants)),
}

file { "${conf_dir}/icinga2.conf":
ensure => file,
content => $template_mainconfig,
content => icinga::newline($_mainconfig),
}

file { "${conf_dir}/features-enabled":
Expand Down
2 changes: 1 addition & 1 deletion manifests/config/fragment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
) {
case $facts['os']['family'] {
'windows': {
$_content = regsubst($content, '\n', "\r\n", 'EMG')
$_content = icinga::newline($content)
} # windows
default: {
Concat {
Expand Down
6 changes: 3 additions & 3 deletions manifests/feature/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
file { $_ssl_key_path:
ensure => file,
mode => $_ssl_key_mode,
content => icinga2::newline($ssl_key),
content => icinga::newline($ssl_key),
tag => 'icinga2::config::file',
show_diff => false,
backup => false,
Expand All @@ -262,15 +262,15 @@
if $ssl_cert {
file { $_ssl_cert_path:
ensure => file,
content => icinga2::newline($ssl_cert),
content => icinga::newline($ssl_cert),
tag => 'icinga2::config::file',
}
}

if $ssl_cacert {
file { $_ssl_cacert_path:
ensure => file,
content => icinga2::newline($ssl_cacert),
content => icinga::newline($ssl_cacert),
tag => 'icinga2::config::file',
}
}
Expand Down
7 changes: 1 addition & 6 deletions manifests/object.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
}
)

$_content = $facts['os']['family'] ? {
'windows' => regsubst($_object, '\n', "\r\n", 'EMG'),
default => $_object,
}

if !defined(Concat[$target]) {
concat { $target:
ensure => present,
Expand All @@ -114,7 +109,7 @@
if $ensure != 'absent' {
concat::fragment { $title:
target => $target,
content => $_content,
content => icinga::newline($_object),
order => $order,
}
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/pki/ca.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@

file { "${ca_dir}/ca.crt":
ensure => file,
content => icinga2::newline($ca_cert),
content => icinga::newline($ca_cert),
tag => 'icinga2::config::file',
before => File[$_ssl_cacert_path],
}

file { "${ca_dir}/ca.key":
ensure => file,
mode => $_ca_key_mode,
content => icinga2::newline($ca_key),
content => icinga::newline($ca_key),
tag => 'icinga2::config::file',
show_diff => false,
backup => false,
Expand Down
6 changes: 3 additions & 3 deletions manifests/tls/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
if icinga2::unwrap($args[key]) {
file { $args['key_file']:
ensure => file,
content => icinga2::newline(icinga2::unwrap($args['key'])),
content => icinga::newline(icinga2::unwrap($args['key'])),
mode => $key_mode,
show_diff => false,
}
Expand All @@ -38,14 +38,14 @@
if $args['cert'] {
file { $args['cert_file']:
ensure => file,
content => icinga2::newline($args['cert']),
content => icinga::newline($args['cert']),
}
}

if $args['cacert'] {
file { $args['cacert_file']:
ensure => file,
content => icinga2::newline($args['cacert']),
content => icinga::newline($args['cacert']),
}
}
}