|
29 | 29 |
|
30 | 30 | $manifests = "${boxen::config::repodir}/modules/people/manifests" |
31 | 31 | $login = regsubst($boxen::config::login, '-','_', 'G') |
| 32 | + $merge_hierarchy = $boxen::config::hiera_merge_hierarchy |
32 | 33 |
|
33 | 34 | if $login != $boxen::config::login { |
34 | 35 | notice("Changed boxen::personal login to ${login}") |
|
40 | 41 | # If $projects looks like ['foo', 'bar'], behaves like: |
41 | 42 | # include projects::foo |
42 | 43 | # include projects::bar |
43 | | - $project_classes = prefix($projects, 'projects::') |
| 44 | + $_projects = $merge_hierarchy ? { |
| 45 | + true => hiera_array("${name}::projects",[]), |
| 46 | + default => $projects |
| 47 | + } |
| 48 | + $project_classes = prefix($_projects, 'projects::') |
44 | 49 | ensure_resource('class', $project_classes) |
45 | 50 |
|
46 | 51 | # If $includes looks like ['foo', 'bar'], behaves like: |
47 | 52 | # class { 'foo': } |
48 | 53 | # class { 'bar': } |
49 | | - ensure_resource('class', $includes) |
| 54 | + $_includes = $merge_hierarchy ? { |
| 55 | + true => hiera_array("${name}::includes",undef), |
| 56 | + default => $includes |
| 57 | + } |
| 58 | + ensure_resource('class', $_includes) |
50 | 59 |
|
51 | | - # $casks and $osx_apps are synonyms. $osx_apps takes precedence |
52 | | - $_casks = $osx_apps ? { |
53 | | - undef => $casks, |
54 | | - default => $osx_apps |
| 60 | + if $merge_hierarchy { |
| 61 | + $merged_osx_apps = hiera_array("${name}::osx_apps",undef) |
| 62 | + $merged_casks = hiera_array("${name}::casks",undef) |
| 63 | + |
| 64 | + $_casks = $merged_osx_apps ? { |
| 65 | + undef => $merged_casks, |
| 66 | + default => $merged_osx_apps |
| 67 | + } |
| 68 | + } |
| 69 | + else { |
| 70 | + # $casks and $osx_apps are synonyms. $osx_apps takes precedence |
| 71 | + $_casks = $osx_apps ? { |
| 72 | + undef => $casks, |
| 73 | + default => $osx_apps |
| 74 | + } |
55 | 75 | } |
| 76 | + |
56 | 77 | # If any casks/osx_apps are specified, declare them as brewcask packages |
57 | 78 | if count($_casks) > 0 { include brewcask } |
58 | 79 | ensure_resource('package', $_casks, { |
|
62 | 83 | }) |
63 | 84 |
|
64 | 85 | # If any homebrew packages are specified , declare them |
65 | | - ensure_resource('package', $homebrew_packages, { |
| 86 | + $_homebrew_packages = $merge_hierarchy ? { |
| 87 | + true => hiera_array("${name}::homebrew_packages",undef), |
| 88 | + default => $homebrew_packages |
| 89 | + } |
| 90 | + ensure_resource('package', $_homebrew_packages, { |
66 | 91 | 'provider' => 'homebrew', |
67 | 92 | }) |
68 | 93 |
|
|
77 | 102 | # } |
78 | 103 | # |
79 | 104 | # Multiple projects may be specified in the $custom_projects hash. |
80 | | - create_resources(boxen::project, $custom_projects) |
| 105 | + $_custom_projects = $merge_hierarchy ? { |
| 106 | + true => hiera_array("${name}::custom_projects",{}), |
| 107 | + default => $custom_projects |
| 108 | + } |
| 109 | + create_resources(boxen::project, $_custom_projects) |
81 | 110 | } |
0 commit comments