Puppet Plan: cd4peadm::upgrade::set_default_config_values
- Defined in:
- plans/upgrade/set_default_config_values.pp
Summary
Overview
This plan is required to run as part of upgrade from any 5.x version to 5.2.0, when the default values for db usernames and runtime were removed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'plans/upgrade/set_default_config_values.pp', line 7
plan cd4peadm::upgrade::set_default_config_values(
String $hiera_data_file_path = 'data/common.yaml',
) {
$hiera_config = loadyaml($hiera_data_file_path)
$old_config = $hiera_config['cd4peadm::config']
# We assume if we find blank values, they are the old default values
$new_config = {
'cd4pe_db_username' => 'cd4pe',
'query_db_username' => 'query',
'runtime' => 'docker',
}.filter |$key, $value| {
$old_config[$key] == undef
}
if(!$new_config.empty) {
$merged_config = deep_merge($old_config, $new_config)
out::message("Found blank configuration options, filling in '${new_config}'")
cd4peadm::save_yaml_file({ 'cd4peadm::config' => $merged_config }, $hiera_data_file_path)
out::message("Saved Hiera config file to ${hiera_data_file_path}")
}
}
|