|
100 | 100 |
|
101 | 101 | $dns_alt_names_csv = $dns_alt_names.reduce |$csv,$x| { "${csv},${x}" }
|
102 | 102 |
|
103 |
| - # Process user input for r10k private key (content or file) and set |
| 103 | + # Process user input for r10k private key (file or content) and set |
104 | 104 | # appropriate value in $r10k_private_key. The value of this variable should
|
105 | 105 | # either be undef or else the key content to write.
|
106 |
| - $r10k_private_key = [ |
107 |
| - $r10k_private_key_file, |
108 |
| - $r10k_private_key_content, |
109 |
| - ].peadm::flatten_compact.size ? { |
110 |
| - 0 => undef, # no key data supplied |
111 |
| - 2 => fail('Must specify either one or neither of r10k_private_key_file and r10k_private_key_content; not both'), |
112 |
| - 1 => $r10k_private_key_file ? { |
113 |
| - String => file($r10k_private_key_file), # key file path supplied, read data from file |
114 |
| - undef => $r10k_private_key_content, # key content supplied directly, use as-is |
115 |
| - }, |
116 |
| - } |
| 106 | + $r10k_private_key = peadm::file_or_content('r10k_private_key', $r10k_private_key_file, $r10k_private_key_content) |
117 | 107 |
|
118 |
| - $license_key = [ |
119 |
| - $license_key_file, |
120 |
| - $license_key_content, |
121 |
| - ].peadm::flatten_compact.size ? { |
122 |
| - 0 => undef, # no key data supplied |
123 |
| - 2 => fail('Must specify either one or neither of license_key_file and license_key_content; not both'), |
124 |
| - 1 => $license_key_file ? { |
125 |
| - String => file($license_key_file), # key file path supplied, read data from file |
126 |
| - undef => $license_key_content, # key content supplied directly, use as-is |
127 |
| - }, |
128 |
| - } |
| 108 | + # Same for license key |
| 109 | + $license_key = peadm::file_or_content('license_key', $license_key_file, $license_key_content) |
129 | 110 |
|
130 | 111 | $precheck_results = run_task('peadm::precheck', $all_targets)
|
131 | 112 | $platform = $precheck_results.first['platform'] # Assume the platform of the first result correct
|
|
233 | 214 | }
|
234 | 215 |
|
235 | 216 | if $r10k_private_key {
|
236 |
| - run_task('peadm::mkdir_p_file', [$master_target, $master_replica_target], |
| 217 | + run_task('peadm::mkdir_p_file', peadm::flatten_compact([ |
| 218 | + $master_target, |
| 219 | + $master_replica_target, |
| 220 | + ]), |
237 | 221 | path => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa',
|
238 | 222 | owner => 'pe-puppet',
|
239 | 223 | group => 'pe-puppet',
|
|
243 | 227 | }
|
244 | 228 |
|
245 | 229 | if $license_key {
|
246 |
| - run_task('peadm::mkdir_p_file', [$master_target, $master_replica_target], |
| 230 | + run_task('peadm::mkdir_p_file', peadm::flatten_compact([ |
| 231 | + $master_target, |
| 232 | + $master_replica_target, |
| 233 | + ]), |
247 | 234 | path => '/etc/puppetlabs/license.key',
|
248 | 235 | owner => 'pe-puppet',
|
249 | 236 | group => 'pe-puppet',
|
|
0 commit comments