From 6e29c99f912f92da8f9728bdfc1ffceb989485fc Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Fri, 18 Sep 2015 11:56:55 +0200 Subject: [PATCH] MT#15261 Fix YML merging order for tt2-daemon The default Hash::Merge->merge() behaviour is LEFT_PRECEDENT: http://search.cpan.org/~rehsack/Hash-Merge-0.200/lib/Hash/Merge.pm Which means: > The values buried in the left hash will never be lost; > any values that can be added from the right hash will be attempted. So, the values from HOST_CONFIG never overwrites default NGCPCTL_CONFIG: > NGCPCTL_CONFIG="${NGCPCTL_MAIN}/config.yml" > HOST_CONFIG="${NGCPCTL_MAIN}/config.$(hostname).yml" We need to use RIGHT_PRECEDENT order to be in sync with 'scripts/build': > ${NGCPCTL_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${NETWORK_CONFIG:-} ${EXTRA_CONFIG_FILES:-} ${CONSTANTS_CONFIG:-} (cherry picked from commit fe7644d24130a935a1bdd6bca8b6482de5c01575) Conflicts: helper/tt2-daemon (cherry picked from commit cd5835156842078ef16849bc0dffb73096b0fc06) Change-Id: I790b837e991724d8ac1b6b9c6b529e70b3bc337f --- helper/tt2-daemon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/tt2-daemon b/helper/tt2-daemon index f8e1a3e5..f6ceccd2 100755 --- a/helper/tt2-daemon +++ b/helper/tt2-daemon @@ -64,7 +64,8 @@ sub handle_connections { next if(exists $loaded_ymls{$file}); $loaded_ymls{$file} = undef; print $client "Loading $file in memory:"; - $config = merge($config, LoadFile($file) || die $!); + my $hm = Hash::Merge->new('RIGHT_PRECEDENT'); + $config = $hm->merge($config, LoadFile($file) || die $!); print $client " OK \n"; }; };