From cf71caa1672a7f66ec8416bc91e75207b37a41d4 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 16 Jan 2023 19:08:55 +0100 Subject: [PATCH] MT#55942 tt2-process: Move YAML config existence check from callers For multi-site support we need to pass all the possible files to load, and these might be different between sites, so we need to check for their existence from within tt2-process, instead of from the outside as that would restrict them to only the current site. Change-Id: I0965506832aa2f0a1ba67b19511c509bec60922e --- helper/tt2-process | 2 ++ scripts/build | 4 +--- scripts/get | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/helper/tt2-process b/helper/tt2-process index 9a5fbfb6..3d240c6d 100755 --- a/helper/tt2-process +++ b/helper/tt2-process @@ -422,6 +422,8 @@ sub merge_yml { return $config if exists $loaded_ymls{$file}; $loaded_ymls{$file} = undef; + return $config if not -f $file; + my $prefix = output_prefix(); print "$prefix: Loading $file in memory:" unless $options{quiet}; my $hm = Hash::Merge->new('RIGHT_PRECEDENT'); diff --git a/scripts/build b/scripts/build index fd192370..f89fa0eb 100755 --- a/scripts/build +++ b/scripts/build @@ -44,9 +44,7 @@ if [ -n "${NGCP_JOBS:-}" ] ; then fi for f in ${NGCPCTL_CONFIG:-} ${NODE_CONFIG:-} ${PAIR_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${MAINTENANCE_CONFIG:-} ${NETWORK_CONFIG:-} "${EXTRA_CONFIG_FILES[@]}" ${CONSTANTS_CONFIG:-} ; do - if [ -r "$f" ] ; then - ARGS+=("-c" "$f") - fi + ARGS+=("-c" "$f") done build_config_files_instances() { diff --git a/scripts/get b/scripts/get index 2087570e..d2af37b6 100755 --- a/scripts/get +++ b/scripts/get @@ -47,9 +47,7 @@ fi # Get the list of configs in proper order to load. declare -a ARGS for f in ${NGCPCTL_CONFIG:-} ${NODE_CONFIG:-} ${PAIR_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${MAINTENANCE_CONFIG:-} ${NETWORK_CONFIG:-} "${EXTRA_CONFIG_FILES[@]}" ${CONSTANTS_CONFIG:-} ; do - if [ -r "$f" ] ; then - ARGS+=("-c" "${f}") - fi + ARGS+=("-c" "${f}") done # main script