Skip to content

Commit

Permalink
Remove redundant function icinga2::unwrap
Browse files Browse the repository at this point in the history
The function can be safely replaced by a build-in Puppet `unwrap()` or
`.unwrap` call.

See https://www.puppet.com/docs/puppet/7/function.html#unwrap
  • Loading branch information
deric committed Dec 21, 2023
1 parent f38a485 commit dc431cb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 39 deletions.
19 changes: 0 additions & 19 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ 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.

### Data types

Expand Down Expand Up @@ -5753,24 +5752,6 @@ Data type: `Hash[String, Any]`



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

Type: Puppet Language

This function returns an unwrap string if necessary.

#### `icinga2::unwrap(Optional[Variant[String, Sensitive[String]]] $arg = undef)`

The icinga2::unwrap function.

Returns: `Any` The unwraped string.

##### `arg`

Data type: `Optional[Variant[String, Sensitive[String]]]`



## Data types

### <a name="Icinga2--BasicAuth"></a>`Icinga2::BasicAuth`
Expand Down
2 changes: 1 addition & 1 deletion functions/db/connect.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function icinga2::db::connect(
'dbname=' => $db['database'],
})), ' '), '= ', '=', 'G')
} else {
$_password = icinga2::unwrap($db['password'])
$_password = unwrap($db['password'])
$options = join(any2array(delete_undef_values({
'-h' => $db['host'] ? {
/localhost/ => undef,
Expand Down
16 changes: 0 additions & 16 deletions functions/unwrap.pp

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
exec { 'idopgsql-import-schema':
user => 'root',
path => $facts['path'],
environment => [sprintf('PGPASSWORD=%s', icinga2::unwrap($password))],
environment => [sprintf('PGPASSWORD=%s', unwrap($password))],
command => "psql '${db_cli_options}' -w -f '${ido_pgsql_schema}'",
unless => "psql '${db_cli_options}' -w -c 'select version from icinga_dbversion'",
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/tls/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
$key_mode = '0400'
}

if icinga2::unwrap($args[key]) {
if unwrap($args[key]) {
file { $args['key_file']:
ensure => file,
content => icinga2::newline(icinga2::unwrap($args['key'])),
content => icinga2::newline(unwrap($args['key'])),
mode => $key_mode,
show_diff => false,
}
Expand Down

0 comments on commit dc431cb

Please sign in to comment.