Puppet Function: icinga2::newline

Defined in:
functions/newline.pp
Function type:
Puppet Language

Summary

Replace newlines for Windows systems.

Overview

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

Parameters:

Returns:

  • (String)

    Text with correct newlines.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'functions/newline.pp', line 7

function icinga2::newline(
  Optional[String] $text,
) >> String {
  # @param text
  #   Text to replace the newlines.
  #

  if $text {
    $result = if $facts['os']['family'] != 'windows' {
      $text
    } else {
      regsubst($text, '\n', "\r\n", 'EMG')
    }
  } else {
    $result = undef
  }

  return $result
}