Fix behavior on empty yaml

parseyaml('') returns false which cannot be used in pick as pick
requires Array or Hash on input. Adding is_bool allows to address this
issue

Proper fix should be in parseyaml itself. [MODULES-2462] should address
this issue.

Change-Id: I1ac53f2944d2fa7831430adbc06893e114191b6d
Closes-Bug: 1488455
This commit is contained in:
Sergii Golovatiuk 2015-08-25 14:34:43 +02:00
parent 80d422554e
commit 968bb2bd79
1 changed files with 10 additions and 2 deletions

View File

@ -14,11 +14,19 @@ if $detach_keystone_plugin {
fail('Keystone service endpoint public VIP is not defined')
}
#TODO (holser): Redesign parseyaml and is_bool once [MODULES-2462] applied
$settings_hash = parseyaml($detach_keystone_plugin['yaml_additional_config'])
$keystone_vip = pick($settings_hash['remote_keystone'],
if is_bool($settings_hash) {
$settings_hash_real = {}
} else {
$settings_hash_real = $settings_hash
}
$keystone_vip = pick($settings_hash_real['remote_keystone'],
$network_metadata['vips']['service_endpoint']['ipaddr'])
$public_keystone_vip = pick($settings_hash['remote_keystone'],
$public_keystone_vip = pick($settings_hash_real['remote_keystone'],
$network_metadata['vips']['public_service_endpoint']['ipaddr'])
$nodes_hash = hiera('nodes')