From ff52cbd435584c6c94842af6fab745bc86ca440b Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Thu, 14 Jul 2022 16:22:27 -0700 Subject: [PATCH] rhel sync: make sure errors go to stderr so we see them Signed-off-by: Kevin Fenzi --- roles/batcave/files/rhel7-sync | 5 +++-- roles/batcave/files/rhel8-sync | 6 +++--- roles/batcave/files/rhel9-sync | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/roles/batcave/files/rhel7-sync b/roles/batcave/files/rhel7-sync index aa240c1a16..2a7c910625 100644 --- a/roles/batcave/files/rhel7-sync +++ b/roles/batcave/files/rhel7-sync @@ -17,6 +17,7 @@ done cd $RHEL7SYNCDIR +echoerr() { printf "%s\n" "$*" >&2; } ## ## Sync out RHEL-7 for appropriate arches for A in ${ARCHES}; do @@ -36,14 +37,14 @@ for A in ${ARCHES}; do echo "Syncing ${R} for ${A}" dnf reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A} if [[ $? -ne 0 ]]; then - echo "Something went wrong with reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A}" + echoerr "Something went wrong with reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A}" continue fi ## Try to create repo pushd ${RHEL7SYNCDIR}/${A}/${R} &> /dev/null createrepo_c -q --update --workers 6 . if [[ $? -ne 0 ]]; then - echo "Something went wrong with createrepo ${A} ${R}" + echoerr "Something went wrong with createrepo ${A} ${R}" continue fi popd &> /dev/null diff --git a/roles/batcave/files/rhel8-sync b/roles/batcave/files/rhel8-sync index 87b1e204ae..de53354580 100644 --- a/roles/batcave/files/rhel8-sync +++ b/roles/batcave/files/rhel8-sync @@ -11,7 +11,7 @@ DNFOPTS='--download-metadata -m --setopt=module_platform_id="platform:el8"' # Need to set the arches we are going to sync down ARCHES="aarch64 ppc64le s390x x86_64" - +echoerr() { printf "%s\n" "$*" >&2; } ## # Do the deeds cd ${RHEL8SYNCDIR} @@ -43,7 +43,7 @@ for A in ${ARCHES}; do echo "Syncing ${R} for ${A}" # Be verbose on errors. if [[ $? -ne 0 ]]; then - echo "Something went wrong with reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" + echoerr "Something went wrong with reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" fi # x86_64 is 'special' because we have to tell it for i686 also. if [[ ${A} == 'x86_64' ]]; then @@ -52,7 +52,7 @@ for A in ${ARCHES}; do dnf reposync -c ${RHEL8SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null fi if [[ $? -ne 0 ]]; then - echo "Something went wrong with dnf reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" + echoerr "Something went wrong with dnf reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" fi done done diff --git a/roles/batcave/files/rhel9-sync b/roles/batcave/files/rhel9-sync index 1b89a735f7..0920646788 100644 --- a/roles/batcave/files/rhel9-sync +++ b/roles/batcave/files/rhel9-sync @@ -11,7 +11,7 @@ DNFOPTS='--download-metadata -m --setopt=module_platform_id="platform:el9"' # Need to set the arches we are going to sync down ARCHES="aarch64 ppc64le s390x x86_64" - +echoerr() { printf "%s\n" "$*" >&2; } ## # Do the deeds cd ${RHEL9SYNCDIR} @@ -43,7 +43,7 @@ for A in ${ARCHES}; do echo "Syncing ${R} for ${A}" # Be verbose on errors. if [[ $? -ne 0 ]]; then - echo "Something went wrong with reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" + echoerr "Something went wrong with reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" fi # x86_64 is 'special' because we have to tell it for i686 also. if [[ ${A} == 'x86_64' ]]; then @@ -52,7 +52,7 @@ for A in ${ARCHES}; do dnf reposync -c ${RHEL9SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null fi if [[ $? -ne 0 ]]; then - echo "Something went wrong with dnf reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" + echoerr "Something went wrong with dnf reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" fi done done