Skip to content

Commit

Permalink
Added lookup() functions to replace hiera_hash() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
robert4man committed May 14, 2018
1 parent 9d9117f commit a39f797
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@

if $crons != undef {
if $crons_hiera_merge_real == true {
$crons_real = hiera_hash('types::crons')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$crons_real = hiera_hash('types::crons')
} else {
$crons_real = lookup('types::crons', Hash, 'deep', {})
}
} else {
$crons_real = $crons
}
Expand All @@ -84,7 +88,11 @@

if $execs != undef {
if $execs_hiera_merge_bool == true {
$execs_real = hiera_hash('types::execs')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$execs_real = hiera_hash('types::execs')
} else {
$execs_real = lookup('types::execs', Hash, 'deep', {})
}
} else {
$execs_real = $execs
}
Expand All @@ -94,7 +102,11 @@

if $file_lines != undef {
if $file_lines_hiera_merge_real == true {
$file_lines_real = hiera_hash('types::file_lines')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$file_lines_real = hiera_hash('types::file_lines')
} else {
$file_lines_real = lookup('types::file_lines', Hash, 'deep', {})
}
} else {
$file_lines_real = $file_lines
}
Expand All @@ -104,7 +116,11 @@

if $files != undef {
if $files_hiera_merge_real == true {
$files_real = hiera_hash('types::files')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$files_real = hiera_hash('types::files')
} else {
$files_real = lookup('types::files', Hash, 'deep', {})
}
} else {
$files_real = $files
}
Expand All @@ -114,7 +130,11 @@

if $mounts != undef {
if $mounts_hiera_merge_real == true {
$mounts_real = hiera_hash('types::mounts')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$mounts_real = hiera_hash('types::mounts')
} else {
$mounts_real = lookup('types::mounts', Hash, 'deep', {})
}
} else {
$mounts_real = $mounts
}
Expand All @@ -124,7 +144,11 @@

if $packages != undef {
if $packages_hiera_merge_real == true {
$packages_real = hiera_hash('types::packages')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$packages_real = hiera_hash('types::packages')
} else {
$packages_real = lookup('types::packages', Hash, 'deep', {})
}
} else {
$packages_real = $packages
}
Expand All @@ -134,7 +158,11 @@

if $selbooleans != undef {
if $selbooleans_hiera_merge_real == true {
$selbooleans_real = hiera_hash('types::selboolean')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$selbooleans_real = hiera_hash('types::selboolean')
} else {
$selbooleans_real = lookup('types::selboolean', Hash, 'deep', {})
}
} else {
$selbooleans_real = $selbooleans
}
Expand All @@ -144,7 +172,11 @@

if $services != undef {
if $services_hiera_merge_real == true {
$services_real = hiera_hash('types::services')
if versioncmp($::puppetversion, '4.0.0') < 0 {
$services_real = hiera_hash('types::services')
} else {
$services_real = lookup('types::services', Hash, 'deep', {})
}
} else {
$services_real = $services
}
Expand Down

0 comments on commit a39f797

Please sign in to comment.